From decf6fc97d361b86d9c87f8da356f2f8159864c5 Mon Sep 17 00:00:00 2001 From: Celestino Rey Date: Fri, 17 May 2024 16:11:14 +0200 Subject: [PATCH] Creada la tabla horas con las horas de servicio --- Padel/initdb.sh | 2 +- Padel/servicios/padel/reservas.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Padel/initdb.sh b/Padel/initdb.sh index 1400574..7f005e2 100644 --- a/Padel/initdb.sh +++ b/Padel/initdb.sh @@ -1 +1 @@ -python -m flask --app padel init-db +python3 -m flask --app padel init-db diff --git a/Padel/servicios/padel/reservas.py b/Padel/servicios/padel/reservas.py index 495ee00..51c8f42 100644 --- a/Padel/servicios/padel/reservas.py +++ b/Padel/servicios/padel/reservas.py @@ -92,6 +92,8 @@ def actualizar_reserva(id): @bp.route("/eligedia", methods=['GET', 'POST']) @login_required def eligedia(): + horas = [9,10,11,12,13,14,17,18,19,20,21] + hoy = date.today() manana = hoy + timedelta(days=1) pasado = hoy + timedelta(days=2) @@ -113,7 +115,6 @@ def eligedia(): # ) # db.commit() - try: db.execute( "DELETE FROM reservas WHERE fecha=?", (ayer,) @@ -139,7 +140,7 @@ def eligedia(): print("No hay horas para hoy") db = get_db() - for hora in range(8,18): + for hora in horas: print("hora: %02d" % hora) db.execute( "INSERT INTO reservas (nombre, fecha, hora) VALUES (?, ?, ?)", ("-", diaelegido, "%02d:00" % hora,),