Skip to content

Commit

Permalink
Update summary table
Browse files Browse the repository at this point in the history
  • Loading branch information
tamarinvs19 committed Dec 20, 2021
1 parent a588a07 commit ae5e99e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions electives/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,16 @@ def generate_summary_table():
for elective in electives:
elective_data = defaultdict(str)
for kind in elective.kinds.all():
elective_data[kind.long_name] = elective.studentonelective_set.filter(
kind=kind
filtered_data = elective.studentonelective_set.filter(
kind=kind,
)
elective_data[kind.long_name] = filtered_data.filter(
attached=True,
).aggregate(
count=Count('student__id', distinct=True)
)['count']
elective_data[f'MAYBE {kind.long_name}'] = filtered_data.filter(
attached=False,
).aggregate(
count=Count('student__id', distinct=True)
)['count']
Expand Down

0 comments on commit ae5e99e

Please sign in to comment.