Prevent double counting of absences #211

Open
opened 2022-03-02 11:08:20 +01:00 by fph · 15 comments
fph commented 2022-03-02 11:08:20 +01:00 (Migrated from edugit.org)

If a student is absent from a lesson to which two teachers are assigned, he or she will be counted as having missed two lessons. This case of team-teaching should be excluded from the summation of absences.

If a student is absent from a lesson to which two teachers are assigned, he or she will be counted as having missed two lessons. This case of team-teaching should be excluded from the summation of absences.
yuha commented 2022-03-14 21:31:31 +01:00 (Migrated from edugit.org)

created branch 211-prevent-double-counting-of-absences to address this issue

created branch [`211-prevent-double-counting-of-absences`](/AlekSIS/official/AlekSIS-App-Alsijil/-/compare/master...211-prevent-double-counting-of-absences) to address this issue
yuha commented 2022-03-14 21:31:37 +01:00 (Migrated from edugit.org)

mentioned in merge request !663

mentioned in merge request !663
yuha commented 2022-03-14 21:31:43 +01:00 (Migrated from edugit.org)

assigned to @yuha

assigned to @yuha
yuha commented 2022-03-15 21:10:09 +01:00 (Migrated from edugit.org)

This issue does not exist in the way it is described - absences are correctly counted when there are multiple teachers assigned to one lesson, since the amount of personal notes (linked to lessons independent of their amount of teachers) with the absent attribute set to true is evaluated. Could you @fph please elaborate on some cases where this issue occurs?

This issue does not exist in the way it is described - absences are correctly counted when there are multiple teachers assigned to one lesson, since the amount of personal notes (linked to lessons independent of their amount of teachers) with the absent attribute set to true is evaluated. Could you @fph please elaborate on some cases where this issue occurs?
yuha (Migrated from edugit.org) closed this issue 2022-03-15 21:10:10 +01:00
hansegucker commented 2022-03-15 21:11:51 +01:00 (Migrated from edugit.org)

@yuha I thought we just agreed that there is an issue – it's just not formulated very exactly in this issue.

@yuha I thought we just agreed that there is an issue – it's just not formulated very exactly in this issue.
hansegucker (Migrated from edugit.org) reopened this issue 2022-03-15 21:12:04 +01:00
nik commented 2022-03-20 10:32:08 +01:00 (Migrated from edugit.org)

DISTINCT on weekday and period when counting (not only absences, but all counting for personal notes)

`DISTINCT` on weekday and period when counting (not only absences, but all counting for personal notes)
yuha commented 2022-03-22 19:31:10 +01:00 (Migrated from edugit.org)

You can't specify fields to check only when filtering distinct objects using Count(). See https://docs.djangoproject.com/en/4.0/ref/models/querysets/#count-1

You can't specify fields to check only when filtering distinct objects using Count(). See https://docs.djangoproject.com/en/4.0/ref/models/querysets/#count-1
hansegucker commented 2022-03-22 19:37:40 +01:00 (Migrated from edugit.org)

But you can use a Subquery instead:

absence_count = Subquery(
            Person.objects.filter(school_term_q & groups_q)
            .filter(pk=OuterRef("pk"),)
            .distinct(<your-fields>)
            .annotate(absence_count=Count("absent"))
            .values("absence_count")
        )
But you can use a Subquery instead: ```python absence_count = Subquery( Person.objects.filter(school_term_q & groups_q) .filter(pk=OuterRef("pk"),) .distinct(<your-fields>) .annotate(absence_count=Count("absent")) .values("absence_count") ) ```
yuha commented 2022-04-26 03:17:08 +02:00 (Migrated from edugit.org)

Problem: You can't query with properties like you can do with normal model fields - and therefore, using .distinct with the respective period will be at least unpleasant.

Problem: You can't query with properties like you can do with normal model fields - and therefore, using .distinct with the respective period will be at least unpleasant.
nik commented 2022-06-05 11:21:03 +02:00 (Migrated from edugit.org)

assigned to @nik and unassigned @yuha

assigned to @nik and unassigned @yuha
nik commented 2022-06-23 23:32:48 +02:00 (Migrated from edugit.org)

@hansegucker Neither @yuha nor me can find any location where the proposed subquery could be applied in the code (there is not a single mention of school_term_q in Alsijil, and groups_q is only mentioned in another context).

Please get together and fix this issue.

@hansegucker Neither @yuha nor me can find any location where the proposed subquery could be applied in the code (there is not a single mention of `school_term_q` in Alsijil, and `groups_q` is only mentioned in another context). Please get together and fix this issue.
nik commented 2022-06-23 23:32:56 +02:00 (Migrated from edugit.org)

assigned to @hansegucker and unassigned @nik

assigned to @hansegucker and unassigned @nik
nik commented 2022-06-24 11:23:41 +02:00 (Migrated from edugit.org)

Wortprotokoll:

Also der Punkt ist es kann Kurse geben also die sind exakt parallel also Stunde ist gleich TRag ist gleich und ähm in beiden Kursen sind die gleichen Schüler drin. ALso ein Schüler ist quasi in zwei Unterrichten gleichzeitig. Zum Beispiel bei einer Englisch-Intensivierungsstunde. So, wenn jetzt beide Lehrer ankreuzen, ass die Person abwesend ist, hat die Person zwei Stunden, in der sie abwesend war, obwohl sie nur in einer Stunde abwesend war. Daraus hat Herr Poetzsch-Heffter dieses Issue gemacht.

Wortprotokoll: Also der Punkt ist es kann Kurse geben also die sind exakt parallel also Stunde ist gleich TRag ist gleich und ähm in beiden Kursen sind die gleichen Schüler drin. ALso ein Schüler ist quasi in zwei Unterrichten gleichzeitig. Zum Beispiel bei einer Englisch-Intensivierungsstunde. So, wenn jetzt beide Lehrer ankreuzen, ass die Person abwesend ist, hat die Person zwei Stunden, in der sie abwesend war, obwohl sie nur in einer Stunde abwesend war. Daraus hat Herr Poetzsch-Heffter dieses Issue gemacht.
nik commented 2022-06-24 11:24:22 +02:00 (Migrated from edugit.org)

This seems not to be an issue in one of our stable deployments right now, so this is postponed until we refurbish the data model and implement attendance lists ("Anwesenheitskontrolle").

This seems not to be an issue in one of our stable deployments right now, so this is postponed until we refurbish the data model and implement attendance lists ("Anwesenheitskontrolle").
nik commented 2022-06-24 11:24:27 +02:00 (Migrated from edugit.org)

unassigned @hansegucker

unassigned @hansegucker
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
aleksis/AlekSIS-App-Alsijil#211
No description provided.