feat(members/waitinglist): add group age range info to invite text

pull/168/head
mariusrklein 5 months ago
parent 416af36070
commit 0c6cbc5966

@ -120,6 +120,15 @@ class Group(models.Model):
else: else:
return "" return ""
def has_age_info(self):
return self.year_from and self.year_to
def get_age_info(self):
if self.has_age_info():
return f"Jahrgang {self.year_from} bis {self.year_to}"
else:
return ""
def get_invitation_text_template(self): def get_invitation_text_template(self):
"""The text template used to invite waiters to this group. This contains """The text template used to invite waiters to this group. This contains
placeholders for the name of the waiter and personalized links.""" placeholders for the name of the waiter and personalized links."""
@ -131,8 +140,14 @@ class Group(models.Model):
group_time = self.get_time_info() group_time = self.get_time_info()
else: else:
group_time = settings.GROUP_TIME_UNAVAILABLE_TEXT.format(contact_email=self.contact_email) group_time = settings.GROUP_TIME_UNAVAILABLE_TEXT.format(contact_email=self.contact_email)
if self.has_age_info():
group_age = self.get_age_info()
else:
group_age = "keine Angabe"
return settings.INVITE_TEXT.format(group_time=group_time, return settings.INVITE_TEXT.format(group_time=group_time,
group_name=self.name, group_name=self.name,
group_age=group_age,
group_link=group_link, group_link=group_link,
contact_email=self.contact_email) contact_email=self.contact_email)

Loading…
Cancel
Save