From 94e8258181b135b69d988c485082a0badc351afd Mon Sep 17 00:00:00 2001 From: Victoria Earl Date: Fri, 25 Oct 2024 13:47:36 -0400 Subject: [PATCH] Fix staffers page when set to 'All' depts There's no single department set if you're viewing all your assigned departments, which was causing a 500 error. --- uber/site_sections/shifts_admin.py | 3 ++- uber/templates/shifts_admin/staffers.html | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/uber/site_sections/shifts_admin.py b/uber/site_sections/shifts_admin.py index 63880260f..64464b0f9 100644 --- a/uber/site_sections/shifts_admin.py +++ b/uber/site_sections/shifts_admin.py @@ -218,7 +218,8 @@ def staffers(self, session, department_id=None, message=''): dept_filter = [] if department_id == None else [ # noqa: E711 Attendee.dept_memberships.any(department_id=department_id)] attendees = session.staffers(pending=True).filter(*dept_filter).all() - requested_count = len([a for a in department.unassigned_explicitly_requesting_attendees if a.is_valid]) + requested_count = None if not department_id else len( + [a for a in department.unassigned_explicitly_requesting_attendees if a.is_valid]) for attendee in attendees: if session.admin_has_staffer_access(attendee) or department_id: attendee.is_dept_head_here = attendee.is_dept_head_of(department_id) if department_id \ diff --git a/uber/templates/shifts_admin/staffers.html b/uber/templates/shifts_admin/staffers.html index e06434b3d..91efaa189 100644 --- a/uber/templates/shifts_admin/staffers.html +++ b/uber/templates/shifts_admin/staffers.html @@ -40,7 +40,7 @@ or email staffers with shifts here):

Add new volunteer -Review membership requests{% if requested_count %} ({{ requested_count }}){% endif %} +{% if department_id != 'All' %}Review membership requests{% if requested_count %} ({{ requested_count }}){% endif %}{% endif %}