diff --git a/aleksis/apps/alsijil/forms.py b/aleksis/apps/alsijil/forms.py index 0cf0b84ff209e5d3c5da20d747190b763ddbbada..144188edf6599ddbe8f4c4d9a01828ab4b56dbf0 100644 --- a/aleksis/apps/alsijil/forms.py +++ b/aleksis/apps/alsijil/forms.py @@ -180,11 +180,11 @@ class ExtraMarkForm(forms.ModelForm): class ExcuseTypeForm(forms.ModelForm): - layout = Layout("short_name", "name", "count_as_missed_lesson") + layout = Layout("short_name", "name", "count_as_absent") class Meta: model = ExcuseType - fields = ["short_name", "name", "count_as_missed_lesson"] + fields = ["short_name", "name", "count_as_absent"] class PersonOverviewForm(ActionForm): diff --git a/aleksis/apps/alsijil/migrations/0016_add_not_counted_excuse_types.py b/aleksis/apps/alsijil/migrations/0016_add_not_counted_excuse_types.py index 48b38b7c9eae6838ff4108628beeb3234e0edada..c45edee40fca69d73ca7edf67c816d389470f1ef 100644 --- a/aleksis/apps/alsijil/migrations/0016_add_not_counted_excuse_types.py +++ b/aleksis/apps/alsijil/migrations/0016_add_not_counted_excuse_types.py @@ -12,7 +12,7 @@ class Migration(migrations.Migration): operations = [ migrations.AddField( model_name='excusetype', - name='count_as_missed_lesson', - field=models.BooleanField(default=True, help_text="If checked, this excuse type will be counted as missed lesson. If not checked, it won't show up in the absence report.", verbose_name='Count as missed lesson'), + name='count_as_absent', + field=models.BooleanField(default=True, 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.", verbose_name='Count as missed lesson'), ), ] diff --git a/aleksis/apps/alsijil/models.py b/aleksis/apps/alsijil/models.py index 6f64875b5da988be07051b765d5fa306743b8e96..13f58e87f5d40b1f7940f5cda8282036f443793b 100644 --- a/aleksis/apps/alsijil/models.py +++ b/aleksis/apps/alsijil/models.py @@ -50,10 +50,10 @@ class ExcuseType(ExtensibleModel): short_name = models.CharField(max_length=255, unique=True, verbose_name=_("Short name")) name = models.CharField(max_length=255, unique=True, verbose_name=_("Name")) - count_as_missed_lesson = models.BooleanField( + count_as_absent = models.BooleanField( default=True, verbose_name=_("Count as missed lesson"), - help_text=_("If checked, this excuse type will be counted as missed lesson. If not checked, it won't show up " + 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."), ) diff --git a/aleksis/apps/alsijil/tables.py b/aleksis/apps/alsijil/tables.py index 4f22fb68eec618e6f191003423f024584256bd6a..c82385265b37d6b37f365048b2ad8c4b6ae52cf1 100644 --- a/aleksis/apps/alsijil/tables.py +++ b/aleksis/apps/alsijil/tables.py @@ -39,7 +39,7 @@ class ExcuseTypeTable(tables.Table): short_name = tables.Column() count_as_absent = tables.BooleanColumn( verbose_name=_("Count as absent"), - accessor="count_as_missed_lesson", + accessor="count_as_absent", ) edit = tables.LinkColumn( "edit_excuse_type", diff --git a/aleksis/apps/alsijil/templates/alsijil/class_register/person.html b/aleksis/apps/alsijil/templates/alsijil/class_register/person.html index 60b7c275670a0ba4a48a07160f8471b7d36902a1..d11b192fbecb27004b1cb850e0e3070239975187 100644 --- a/aleksis/apps/alsijil/templates/alsijil/class_register/person.html +++ b/aleksis/apps/alsijil/templates/alsijil/class_register/person.html @@ -150,7 +150,7 @@ <th colspan="2">{% trans 'Unexcused' %}</th> <td>{{ stat.unexcused }}</td> </tr> - {% for excuse_type in excuse_types_not_missed %} + {% for excuse_type in excuse_types_not_absent %} <tr> <th colspan="3">{{ excuse_type.name }}</th> <td>{{ stat|get_dict:excuse_type.count_label }}</td> diff --git a/aleksis/apps/alsijil/views.py b/aleksis/apps/alsijil/views.py index a7ef660986f4c3ad61d744fae38167858c6a6bf8..5226e591beee9628124fb734dcbb76ebd44221c1 100644 --- a/aleksis/apps/alsijil/views.py +++ b/aleksis/apps/alsijil/views.py @@ -893,8 +893,8 @@ def overview_person(request: HttpRequest, id_: Optional[int] = None) -> HttpResp note.set_object_permission_checker(checker) personal_notes_list.append(note) context["personal_notes"] = personal_notes_list - context["excuse_types"] = ExcuseType.objects.filter(count_as_missed_lesson=True) - context["excuse_types_not_missed"] = ExcuseType.objects.filter(count_as_missed_lesson=False) + context["excuse_types"] = ExcuseType.objects.filter(count_as_absent=True) + context["excuse_types_not_absent"] = ExcuseType.objects.filter(count_as_absent=False) form = PersonOverviewForm(request, request.POST or None, queryset=allowed_personal_notes) if request.method == "POST" and request.user.has_perm( @@ -930,21 +930,21 @@ def overview_person(request: HttpRequest, id_: Optional[int] = None) -> HttpResp stat.update( personal_notes .filter(absent=True) - .exclude(excuse_type__count_as_missed_lesson=False) + .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_missed_lesson=False + 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_missed_lesson=False + excuse_type__count_as_absent=False ).aggregate(excused_no_excuse_type=Count("absent")) ) stat.update(