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
@@ -93,6 +93,16 @@ def annotate_person_statistics(
return persons
def annotate_person_statistics_from_documentations(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))
return annotate_person_statistics(
persons,
Q(participations__related_documentation__in=docs),
Q(new_personal_notes__documentation__in=docs),
)
def annotate_person_statistics_for_school_term(
persons: QuerySet[Person], school_term: SchoolTerm, group: Group | None = None
) -> QuerySet[Person]:
@@ -103,9 +113,4 @@ def annotate_person_statistics_for_school_term(
)
if group:
documentations.filter(Q(course__groups=group) | Q(course__groups__parent_groups=group))
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),
)
return annotate_person_statistics_from_documentations(documentations)
Loading