From af3d9381ad19629df058a999bf3a9754d41b7827 Mon Sep 17 00:00:00 2001 From: "Andreas (@xAndy) Zimmermann" Date: Tue, 17 May 2022 17:11:23 +0200 Subject: [PATCH] unify checkin messaging --- .../migrations/0010_room_meeting_location.py | 18 ++++++++++++++++++ shiftregister/app/models.py | 4 +++- shiftregister/app/templates/shift.html | 3 ++- shiftregister/app/views.py | 2 +- 4 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 shiftregister/app/migrations/0010_room_meeting_location.py diff --git a/shiftregister/app/migrations/0010_room_meeting_location.py b/shiftregister/app/migrations/0010_room_meeting_location.py new file mode 100644 index 0000000..e7a6cb9 --- /dev/null +++ b/shiftregister/app/migrations/0010_room_meeting_location.py @@ -0,0 +1,18 @@ +# Generated by Django 4.0.4 on 2022-05-17 15:01 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("app", "0009_helper_asta_confirmed"), + ] + + operations = [ + migrations.AddField( + model_name="room", + name="meeting_location", + field=models.TextField(default="Infopoint"), + ), + ] diff --git a/shiftregister/app/models.py b/shiftregister/app/models.py index cfb3650..99acf19 100644 --- a/shiftregister/app/models.py +++ b/shiftregister/app/models.py @@ -13,6 +13,7 @@ global_preferences = global_preferences_registry.manager() class Room(models.Model): name = models.CharField(max_length=200, primary_key=True) required_helpers = models.IntegerField() + meeting_location = models.TextField(default="Infopoint") def __str__(self): return self.name @@ -135,7 +136,8 @@ class ShiftRegistration(models.Model): ) def send_reminder(self): - text = f"Deine kontakt-Schicht beginnt um {self.shift.start_at.strftime('%H:%M')}, bitte komm eine halbe Stunde vorher an den Infopoint." + url = reverse("shift", kwargs={"shiftid": self.shift.pk}) + text = f"Deine kontakt-Schicht beginnt um {self.shift.start_at.strftime('%H:%M')}, bitte komm 15 Minuten vorher an den Treffpunkt. https://kontakt.rocks{url}" msg = Message(to=self.helper, text=text) msg.save() self.reminder_sent = True diff --git a/shiftregister/app/templates/shift.html b/shiftregister/app/templates/shift.html index d935197..fa2da7d 100644 --- a/shiftregister/app/templates/shift.html +++ b/shiftregister/app/templates/shift.html @@ -5,7 +5,7 @@ {% block content %}
{% if is_registered %} -
Du bist zu dieser Schicht angemeldet
+
Du bist zu dieser Schicht angemeldet. Bitte komme 15 Minuten vor deiner Schicht am Treffpunkt.
{% endif %} {% if shift.deleted %}
Diese Schicht wurde gelöscht.
@@ -17,6 +17,7 @@ Ort: {{ shift.room.name }}
Beginn: {{ shift.start_at }}
Dauer: {{ shift.duration }}
+ Treffpunkt: {{ shift.room.meeting_location }}
{{ shift.description|linebreaksbr }}
{% if can_register and not shift.deleted %} diff --git a/shiftregister/app/views.py b/shiftregister/app/views.py index 05c64a4..ce23c19 100644 --- a/shiftregister/app/views.py +++ b/shiftregister/app/views.py @@ -216,7 +216,7 @@ def shift(request, shiftid): messages.add_message( request, messages.SUCCESS, - "Erfolgreich angemeldet, bitte komme eine halbe Stunde vor deiner Schicht an den Infopoint", + "Erfolgreich angemeldet, bitte komme 15 Minuten vor deiner Schicht am Treffpunkt", ) # redirect so page can be reloaded without resending post data return redirect("shift", shiftid=shift.pk)