diff --git a/aleksis/apps/alsijil/model_extensions.py b/aleksis/apps/alsijil/model_extensions.py index 0bc0bacce344bd214bac42026a7a8352d6675e10..d18d66867ddfa2bf4c9fe763842b1e3401d6d24e 100644 --- a/aleksis/apps/alsijil/model_extensions.py +++ b/aleksis/apps/alsijil/model_extensions.py @@ -423,20 +423,16 @@ def generate_person_list_with_class_register_statistics( ).annotate( absences_count=Count( "filtered_personal_notes", - filter=Q( - filtered_personal_notes__absent=True - ) & ~Q( - filtered_personal_notes__excuse_type__count_as_absent=False - ), + filter=Q(filtered_personal_notes__absent=True) + & ~Q(filtered_personal_notes__excuse_type__count_as_absent=False), ), excused=Count( "filtered_personal_notes", filter=Q( filtered_personal_notes__absent=True, filtered_personal_notes__excused=True, - ) & ~Q( - filtered_personal_notes__excuse_type__count_as_absent=False - ), + ) + & ~Q(filtered_personal_notes__excuse_type__count_as_absent=False), ), excused_without_excuse_type=Count( "filtered_personal_notes", diff --git a/aleksis/apps/alsijil/models.py b/aleksis/apps/alsijil/models.py index 13f58e87f5d40b1f7940f5cda8282036f443793b..bab140c24c8b1be1a9bc2de845afeed15343eb2c 100644 --- a/aleksis/apps/alsijil/models.py +++ b/aleksis/apps/alsijil/models.py @@ -53,8 +53,10 @@ class ExcuseType(ExtensibleModel): count_as_absent = models.BooleanField( default=True, verbose_name=_("Count as missed lesson"), - help_text=_("If checked, this excuse type will be counted as a missed lesson. If not checked, it won't show up " - "in the absence report."), + help_text=_( + "If checked, this excuse type will be counted as a missed lesson. If not checked," + "it won't show up in the absence report." + ), ) def __str__(self): diff --git a/aleksis/apps/alsijil/views.py b/aleksis/apps/alsijil/views.py index 4efd1174aa79bb607f46979088271ec6f32d5e25..1588519b3e848814772a46d351176a1591821517 100644 --- a/aleksis/apps/alsijil/views.py +++ b/aleksis/apps/alsijil/views.py @@ -931,24 +931,19 @@ def overview_person(request: HttpRequest, id_: Optional[int] = None) -> HttpResp continue stat.update( - personal_notes - .filter(absent=True) - .exclude(excuse_type__count_as_absent=False) - .aggregate(absences_count=Count("absent")) + personal_notes.filter(absent=True) + .exclude(excuse_type__count_as_absent=False) + .aggregate(absences_count=Count("absent")) ) stat.update( - personal_notes.filter( - absent=True, excused=True - ).exclude( - excuse_type__count_as_absent=False - ).aggregate(excused=Count("absent")) + personal_notes.filter(absent=True, excused=True) + .exclude(excuse_type__count_as_absent=False) + .aggregate(excused=Count("absent")) ) stat.update( - personal_notes.filter( - absent=True, excused=True, excuse_type__isnull=True - ).exclude( - excuse_type__count_as_absent=False - ).aggregate(excused_no_excuse_type=Count("absent")) + personal_notes.filter(absent=True, excused=True, excuse_type__isnull=True) + .exclude(excuse_type__count_as_absent=False) + .aggregate(excused_no_excuse_type=Count("absent")) ) stat.update( personal_notes.filter(absent=True, excused=False).aggregate(