paperwork: Fix regression in Shopleads mailing list membership
All checks were successful
Ruff / ruff (push) Successful in 28s
Test / test (push) Successful in 4m30s

This commit is contained in:
Adam Goldsmith 2024-05-09 02:22:33 -04:00
parent 8b1722d1f0
commit 3e003bddb7

View File

@ -49,17 +49,12 @@ class DepartmentViewSet(viewsets.ModelViewSet):
"shop_lead_flag__members",
)
lists: dict[str, MailingList] = {}
shopleads: dict[Member, list[Department]] = {}
for department in departments.filter(has_mailing_list=True):
if department.shop_lead_flag is not None:
moderator_emails = {
member.volunteer_email if member.volunteer_email else member.email
for member in department.shop_lead_flag.members.all()
}
for member in department.shop_lead_flag.members.all():
if member not in shopleads:
shopleads[member] = []
shopleads[member].append(department)
else:
moderator_emails = set()
@ -98,6 +93,13 @@ class DepartmentViewSet(viewsets.ModelViewSet):
if department.parent_id is None:
recurse_children(department)
shopleads: dict[Member, list[Department]] = {}
for department in departments.filter(shop_lead_flag__isnull=False):
for member in department.shop_lead_flag.members.all():
if member not in shopleads:
shopleads[member] = []
shopleads[member].append(department)
# Add members to the Shop Leads mailing list, but don't configure it
lists["ShopLeads"] = {
"members": {