paperwork: Include departments with no mailing list in shopleads mailing list
This commit is contained in:
parent
4562feec34
commit
b4d100478e
@ -28,7 +28,7 @@ class DepartmentViewSet(viewsets.ModelViewSet):
|
|||||||
Generate a mailing list for each department, containing all
|
Generate a mailing list for each department, containing all
|
||||||
certified users for tools in that department or child departments
|
certified users for tools in that department or child departments
|
||||||
"""
|
"""
|
||||||
departments = self.queryset.filter(has_mailing_list=True).prefetch_related(
|
departments = self.queryset.prefetch_related(
|
||||||
"children",
|
"children",
|
||||||
"shop_lead_flag__members",
|
"shop_lead_flag__members",
|
||||||
Prefetch(
|
Prefetch(
|
||||||
@ -37,7 +37,7 @@ class DepartmentViewSet(viewsets.ModelViewSet):
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
lists = {}
|
lists = {}
|
||||||
for department in departments:
|
for department in departments.filter(has_mailing_list=True):
|
||||||
if department.shop_lead_flag is not None:
|
if department.shop_lead_flag is not None:
|
||||||
moderator_emails = {
|
moderator_emails = {
|
||||||
member.email for member in department.shop_lead_flag.members.all()
|
member.email for member in department.shop_lead_flag.members.all()
|
||||||
@ -75,12 +75,12 @@ class DepartmentViewSet(viewsets.ModelViewSet):
|
|||||||
"members"
|
"members"
|
||||||
]
|
]
|
||||||
|
|
||||||
for department in departments:
|
for department in departments.filter(has_mailing_list=True):
|
||||||
if department.parent_id is None:
|
if department.parent_id is None:
|
||||||
recurse_children(department)
|
recurse_children(department)
|
||||||
|
|
||||||
shopleads = {}
|
shopleads = {}
|
||||||
for department in departments:
|
for department in departments.filter(shop_lead_flag__isnull=False):
|
||||||
for member in department.shop_lead_flag.members.all():
|
for member in department.shop_lead_flag.members.all():
|
||||||
if member not in shopleads:
|
if member not in shopleads:
|
||||||
shopleads[member] = []
|
shopleads[member] = []
|
||||||
|
Loading…
Reference in New Issue
Block a user