diff --git a/oh_queue/slack.py b/oh_queue/slack.py index 11ca4ba..797d1bb 100644 --- a/oh_queue/slack.py +++ b/oh_queue/slack.py @@ -206,8 +206,8 @@ def send_appointment_summary(app, course): total=upcoming.total, nonempty=upcoming.nonempty, time=upcoming.start_time.strftime("%I:%M%p"), - delta=(upcoming.start_time - get_current_time()).seconds - // 3600, + delta=round((upcoming.start_time - get_current_time()).seconds + / 3600), ), }, } diff --git a/oh_queue/static/js/components/admin_appointments_manager.js b/oh_queue/static/js/components/admin_appointments_manager.js index cd3001f..382cc3b 100644 --- a/oh_queue/static/js/components/admin_appointments_manager.js +++ b/oh_queue/static/js/components/admin_appointments_manager.js @@ -61,8 +61,11 @@ function AdminAppointmentsManager({ state }) {

- How many appointments should a student have be pending simultaneously? + How many appointments should a student have be pending simultaneously?

+ (by + + ) = daily_threshold: return socket_error("You have already signed up for {} OH slots for the same day".format(daily_threshold)) - num_pending = AppointmentSignup.query.join(AppointmentSignup.appointment).filter( Appointment.status == AppointmentStatus.pending, AppointmentSignup.user_id == current_user.id, - ).count() - if num_pending >= pending_threshold: - return socket_error("You have already signed up for {} OH slots that have not yet occurred.".format(pending_threshold)) + ) + if pending_metric != 'false': + start = appointment.duration + num_pend = [appt.appointment.duration for appt in list(num_pending)] + threshold = datetime.timedelta(minutes=pending_threshold) + for item in num_pend: + start += item + if start > threshold: + return socket_error("You cannot sign up for more than {} minutes of OH that have not yet occurred.".format(pending_threshold)) + else: + if num_pending.count() >= pending_threshold: + return socket_error("You have already signed up for {} OH slots that have not yet occurred.".format(pending_threshold)) old_signup = AppointmentSignup.query.filter_by( appointment_id=data["appointment_id"],