Skip to content
Snippets Groups Projects
Verified Commit 703fdd62 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Add distinct to group-based statistic views

parent 49bf244e
No related branches found
No related tags found
1 merge request!294Resolve "Students are listed multiple times in class register views"
Pipeline #86370 canceled
......@@ -13,6 +13,7 @@ Fixed
~~~~~
* Students were displayed multiple times in class register views.
* Absences were counted multiple times in some class register views.
`2.1`_ - 2022-06-25
-------------------
......
......@@ -434,6 +434,7 @@ def generate_person_list_with_class_register_statistics(
"filtered_personal_notes",
filter=Q(filtered_personal_notes__absent=True)
& ~Q(filtered_personal_notes__excuse_type__count_as_absent=False),
distinct=True,
),
excused=Count(
"filtered_personal_notes",
......@@ -442,6 +443,7 @@ def generate_person_list_with_class_register_statistics(
filtered_personal_notes__excused=True,
)
& ~Q(filtered_personal_notes__excuse_type__count_as_absent=False),
distinct=True,
),
excused_without_excuse_type=Count(
"filtered_personal_notes",
......@@ -450,15 +452,16 @@ def generate_person_list_with_class_register_statistics(
filtered_personal_notes__excused=True,
filtered_personal_notes__excuse_type__isnull=True,
),
distinct=True,
),
unexcused=Count(
"filtered_personal_notes",
filter=Q(filtered_personal_notes__absent=True, filtered_personal_notes__excused=False),
distinct=True,
),
tardiness=Sum("filtered_personal_notes__late"),
tardiness_count=Count(
"filtered_personal_notes",
filter=Q(filtered_personal_notes__late__gt=0),
"filtered_personal_notes", filter=Q(filtered_personal_notes__late__gt=0), distinct=True
),
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment