Skip to content
Snippets Groups Projects

Resolve "Add export functionality to course book"

Merged permcu requested to merge 258-add-export-functionality-to-course-book into master
2 files
+ 7
4
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -93,9 +93,12 @@ def annotate_person_statistics(
return persons
def annotate_person_statistics_from_documentations(docs: QuerySet[Documentation]) -> QuerySet[Person]:
def annotate_person_statistics_from_documentations(
persons: QuerySet[Person],
docs: QuerySet[Documentation]
) -> QuerySet[Person]:
"""Annotate a queryset of persons with class register statistics from queryset of documentations."""
docs = list(documentations.values_list("pk", flat=True))
docs = list(docs.values_list("pk", flat=True))
return annotate_person_statistics(
persons,
Q(participations__related_documentation__in=docs),
@@ -113,4 +116,4 @@ def annotate_person_statistics_for_school_term(
)
if group:
documentations.filter(Q(course__groups=group) | Q(course__groups__parent_groups=group))
return annotate_person_statistics_from_documentations(documentations)
return annotate_person_statistics_from_documentations(persons, documentations)
Loading