diff --git a/shiftregister/app/models.py b/shiftregister/app/models.py
index 2dc4def..ea3931c 100644
--- a/shiftregister/app/models.py
+++ b/shiftregister/app/models.py
@@ -57,12 +57,16 @@ class Shift(models.Model):
return (self.start_at <= timezone.now()) and (not self.has_ended())
def registration_count(self):
- return self.shiftregistration_set.filter(
- state__in=[
- ShiftRegistration.RegState.REGISTERED,
- ShiftRegistration.RegState.CHECKED_IN,
- ]
- ).count()
+ return (
+ self.reg_count
+ if hasattr(self, "reg_count")
+ else self.shiftregistration_set.filter(
+ state__in=[
+ ShiftRegistration.RegState.REGISTERED,
+ ShiftRegistration.RegState.CHECKED_IN,
+ ]
+ ).count()
+ )
class Helper(models.Model):
diff --git a/shiftregister/app/templates/partials/shift_listitem.html b/shiftregister/app/templates/partials/shift_listitem.html
index 0f495bd..2cc710f 100644
--- a/shiftregister/app/templates/partials/shift_listitem.html
+++ b/shiftregister/app/templates/partials/shift_listitem.html
@@ -9,7 +9,7 @@
Ort: {{ shift.room.name }}
Beginn: {{ shift.start_at }}
Dauer: {{ shift.duration|duration }}
- Belegung: {{ shift.reg_count }}/{{ shift.required_helpers|default:shift.room.required_helpers }}
+ Belegung: {{ shift.registration_count }}/{{ shift.required_helpers|default:shift.room.required_helpers }}