From b2ace0759bb704ba1eb15db012ad4f1b1b61b002 Mon Sep 17 00:00:00 2001
From: amanshah2711 <36978283+amanshah2711@users.noreply.github.com>
Date: Tue, 14 Jul 2020 22:53:39 -0400
Subject: [PATCH 1/5] updating oh appts so pending appoints can be restricted
by time (#219)
---
.../components/admin_appointments_manager.js | 5 +++-
oh_queue/views.py | 23 +++++++++++++++----
2 files changed, 23 insertions(+), 5 deletions(-)
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"],
From bddbf8ff666e5f3f53b7157d6ab2cd50c890ecc8 Mon Sep 17 00:00:00 2001
From: somaniarushi
Date: Mon, 20 Jul 2020 17:39:09 -0700
Subject: [PATCH 2/5] collapsing names for huge navbars
---
oh_queue/static/js/components/navbar.js | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/oh_queue/static/js/components/navbar.js b/oh_queue/static/js/components/navbar.js
index 9009dd1..af38dcf 100644
--- a/oh_queue/static/js/components/navbar.js
+++ b/oh_queue/static/js/components/navbar.js
@@ -55,7 +55,7 @@ let Navbar = ({ state, mode }) => {
{currentUser ?
@@ -73,3 +73,20 @@ let Navbar = ({ state, mode }) => {
);
}
+
+/*
+Function to take in a username, and boolean values for whether the user is a staff member and
+currently in a group. If both of those are true, then the user's name is reduced to their
+initials. Else, their name is returned.
+*/
+function getDisplayName(usrname, isStaff, myGroup) {
+ if (isStaff && myGroup) {
+ var display = ""
+ var names = (usrname.split(" "));
+ names.forEach(name => {
+ display = display + name.charAt(0)
+ });
+ return display;
+ }
+ return usrname
+}
\ No newline at end of file
From dd77b2b3bdf01c25963c3a400ce8e22f0c2bbf9d Mon Sep 17 00:00:00 2001
From: somaniarushi
Date: Mon, 20 Jul 2020 17:47:33 -0700
Subject: [PATCH 3/5] isGroup -> myGroup
---
oh_queue/static/js/components/navbar.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/oh_queue/static/js/components/navbar.js b/oh_queue/static/js/components/navbar.js
index af38dcf..e30a8fc 100644
--- a/oh_queue/static/js/components/navbar.js
+++ b/oh_queue/static/js/components/navbar.js
@@ -55,7 +55,7 @@ let Navbar = ({ state, mode }) => {
{currentUser ?
@@ -71,21 +77,4 @@ let Navbar = ({ state, mode }) => {
);
-}
-
-/*
-Function to take in a username, and boolean values for whether the user is a staff member and
-currently in a group. If both of those are true, then the user's name is reduced to their
-initials. Else, their name is returned.
-*/
-function getDisplayName(usrname, isStaff, myGroup) {
- if (isStaff && myGroup) {
- var display = ""
- var names = (usrname.split(" "));
- names.forEach(name => {
- display = display + name.charAt(0)
- });
- return display;
- }
- return usrname
}
\ No newline at end of file