From c3fbffa0f46e8fd33d057212c58d0accbdce4c38 Mon Sep 17 00:00:00 2001 From: Julian Leucker <leuckerj@gmail.com> Date: Wed, 13 Apr 2022 19:41:01 +0200 Subject: [PATCH] Rename `count_as_missed_lesson` to `count_as_absent` --- aleksis/apps/alsijil/forms.py | 4 ++-- .../migrations/0016_add_not_counted_excuse_types.py | 4 ++-- aleksis/apps/alsijil/models.py | 4 ++-- aleksis/apps/alsijil/tables.py | 2 +- .../templates/alsijil/class_register/person.html | 2 +- aleksis/apps/alsijil/views.py | 10 +++++----- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/aleksis/apps/alsijil/forms.py b/aleksis/apps/alsijil/forms.py index 0cf0b84ff..144188edf 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 48b38b7c9..c45edee40 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 6f64875b5..13f58e87f 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 4f22fb68e..c82385265 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 60b7c2756..d11b192fb 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 a7ef66098..5226e591b 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( -- GitLab