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

pull/1/head
parent 472bd6f629
commit c8a4575c1b

@ -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):

@ -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 %}

Loading…
Cancel
Save