2
0
Fork 0

dont show cancel text for passed shifts, put shift in container

This commit is contained in:
Andreas (@xAndy) Zimmermann 2022-04-20 17:33:15 +02:00
parent 472bd6f629
commit c8a4575c1b
2 changed files with 5 additions and 1 deletions

View File

@ -20,6 +20,8 @@ class Shift(models.Model):
# todo: add helper amount override field # todo: add helper amount override field
def __str__(self): def __str__(self):
return f"{self.room.name}: {self.start_at}" return f"{self.room.name}: {self.start_at}"
def has_ended(self):
return (self.start_at + self.duration) < timezone.now()
class Helper(models.Model): class Helper(models.Model):

View File

@ -2,6 +2,7 @@
{% block title %}Schichtansicht{% endblock %} {% block title %}Schichtansicht{% endblock %}
{% block content %} {% block content %}
<div class="box">
{% if is_registered %} {% if is_registered %}
<div>Du bist zu dieser Schicht angemeldet</div> <div>Du bist zu dieser Schicht angemeldet</div>
{% endif %} {% endif %}
@ -22,8 +23,9 @@ Dauer: {{ shift.duration }}<br>
{{ shift_form.as_p }} {{ shift_form.as_p }}
<input type="submit" value="Abmelden"> <input type="submit" value="Abmelden">
</form> </form>
{% else %} {% elif not shift.has_ended %}
Bitte wende dich an den Infopoint, falls du es nicht zu deiner Schicht schaffst. Bitte wende dich an den Infopoint, falls du es nicht zu deiner Schicht schaffst.
{% endif %} {% endif %}
{% endif %} {% endif %}
</div>
{% endblock %} {% endblock %}