Update exam counts to use distinct counts for archived and non-archived exams
This commit is contained in:
+12
-6
@@ -5354,12 +5354,12 @@ class ExamCollectionList(ListView):
|
||||
if show_archived:
|
||||
# include archived exams in counts (count all exams for each app)
|
||||
counts = {
|
||||
"anatomy_count": Count("anatomy_exams"),
|
||||
"longs_count": Count("longs_exams"),
|
||||
"physics_count": Count("physics_exams"),
|
||||
"rapids_count": Count("rapids_exams"),
|
||||
"sbas_count": Count("sbas_exams"),
|
||||
"shorts_count": Count("shorts_exams"),
|
||||
"anatomy_count": Count("anatomy_exams", distinct=True),
|
||||
"longs_count": Count("longs_exams", distinct=True),
|
||||
"physics_count": Count("physics_exams", distinct=True),
|
||||
"rapids_count": Count("rapids_exams", distinct=True),
|
||||
"sbas_count": Count("sbas_exams", distinct=True),
|
||||
"shorts_count": Count("shorts_exams", distinct=True),
|
||||
}
|
||||
else:
|
||||
# only count non-archived exams
|
||||
@@ -5367,26 +5367,32 @@ class ExamCollectionList(ListView):
|
||||
"anatomy_count": Count(
|
||||
"anatomy_exams",
|
||||
filter=Q(anatomy_exams__archive=False),
|
||||
distinct=True,
|
||||
),
|
||||
"longs_count": Count(
|
||||
"longs_exams",
|
||||
filter=Q(longs_exams__archive=False),
|
||||
distinct=True,
|
||||
),
|
||||
"physics_count": Count(
|
||||
"physics_exams",
|
||||
filter=Q(physics_exams__archive=False),
|
||||
distinct=True,
|
||||
),
|
||||
"rapids_count": Count(
|
||||
"rapids_exams",
|
||||
filter=Q(rapids_exams__archive=False),
|
||||
distinct=True,
|
||||
),
|
||||
"sbas_count": Count(
|
||||
"sbas_exams",
|
||||
filter=Q(sbas_exams__archive=False),
|
||||
distinct=True,
|
||||
),
|
||||
"shorts_count": Count(
|
||||
"shorts_exams",
|
||||
filter=Q(shorts_exams__archive=False),
|
||||
distinct=True,
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user