Skip to content

Commit

Permalink
Fix staffers page when set to 'All' depts
Browse files Browse the repository at this point in the history
There's no single department set if you're viewing all your assigned departments, which was causing a 500 error.
  • Loading branch information
kitsuta committed Oct 25, 2024
1 parent 2898d96 commit 94e8258
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion uber/site_sections/shifts_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion uber/templates/shifts_admin/staffers.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
or <a href="mailto:{{ c.ADMIN_EMAIL|email_only }}?bcc={{ emails_with_shifts }}">email staffers with shifts here</a>)<b>:</b>
<br/> <br/>
<a href="#attendee_form?id=None" class="btn btn-primary">Add new volunteer</a>
<a href="../dept_admin/requests?department_id={{ department_id }}" class="btn btn-info" target="_blank">Review membership requests{% if requested_count %} ({{ requested_count }}){% endif %}</a>
{% if department_id != 'All' %}<a href="../dept_admin/requests?department_id={{ department_id }}" class="btn btn-info" target="_blank">Review membership requests{% if requested_count %} ({{ requested_count }}){% endif %}</a>{% endif %}
<br/><br/>

<table class="table table-striped datatable">
Expand Down

0 comments on commit 94e8258

Please sign in to comment.