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
+ 26
7
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -115,6 +115,19 @@ def annotate_person_statistics(
return persons
def annotate_person_statistics_from_documentations(
persons: QuerySet[Person], docs: QuerySet[Documentation]
) -> QuerySet[Person]:
"""Annotate a queryset of persons with class register statistics from documentations."""
docs = list(docs.values_list("pk", flat=True))
return annotate_person_statistics(
persons,
Q(participations__related_documentation__in=docs),
Q(new_personal_notes__documentation__in=docs),
ignore_filters=len(docs) == 0,
)
def annotate_person_statistics_for_school_term(
persons: QuerySet[Person], school_term: SchoolTerm, group: Group | None = None
) -> QuerySet[Person]:
@@ -133,10 +146,4 @@ def annotate_person_statistics_for_school_term(
)
)
)
docs = list(documentations.values_list("pk", flat=True))
return annotate_person_statistics(
persons,
Q(participations__related_documentation__in=docs),
Q(new_personal_notes__documentation__in=docs),
ignore_filters=len(docs) == 0,
)
return annotate_person_statistics_from_documentations(persons, documentations)
Loading