feat: optimizacion zocalos aulas, metricas ocupacion dia/semana/mes, modificacion de reservas y permisos RBAC en gestion

This commit is contained in:
Carlos Tello
2026-09-03 11:16:07 -03:00
parent cde62c9b0a
commit c9dc3d9208
13 changed files with 957 additions and 87 deletions
+6 -2
View File
@@ -27,6 +27,10 @@ class ReservationForm(FlaskForm):
])
submit = SubmitField(_l('Make Reservation'))
def __init__(self, *args, is_edit=False, **kwargs):
super().__init__(*args, **kwargs)
self.is_edit = is_edit
def validate_end_time(self, field):
if field.data <= self.start_time.data:
raise ValidationError('End time must be after start time.')
@@ -36,8 +40,8 @@ class ReservationForm(FlaskForm):
raise ValidationError('Reservation cannot exceed 8 hours.')
def validate_start_time(self, field):
# Don't allow reservations in the past
if field.data < datetime.now():
# Don't allow new reservations in the past
if not self.is_edit and field.data < datetime.now() - timedelta(minutes=10):
raise ValidationError('Start time cannot be in the past.')
# Don't allow reservations too far in the future (max 3 months)