Skip to content
Snippets Groups Projects

Resolve "Add export functionality to absence statistics page"

All threads resolved!
Files
2
Nik | Klampfradler
Last comment by Jonathan Weth
@@ -9,11 +9,22 @@ from ..models import Documentation, ExtraMark, NewPersonalNote, ParticipationSta
class BuilderError(Exception):
"""Error in building statistics using the StatisticsBuilder."""
pass
class StatisticsBuilder:
"""Builder class for building queries with annotated statistics on persons.
To build queries, you can combine one `use_` with multiple `annotate` or `prefetch`
methods. At the end, call `build` to get the actual queryset.
>>> StatisticsBuilder(person_qs).use_from_school_term(school_term).annotate_statistics().build()
"""
def __init__(self, persons: QuerySet[Person]) -> None:
"""Intialize the builder with a persons queryset."""
self.qs: QuerySet[Person] = persons
self.participations_filter: Q | None = None
self.personal_notes_filter: Q | None = None
Loading