feat: make team-only shifts distinguishable in backend
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
8e9ef718b8
commit
a16a2d20e3
|
@ -7,7 +7,11 @@
|
|||
<strong>Ort:</strong> <span class="{{ shift.event.calendar.needs_fallback|yesno:"is-underlined," }}">{{ shift.room.name }}</span><br>
|
||||
<strong>Beginn:</strong> {{ shift.start_at }}<br>
|
||||
<strong>Dauer:</strong> {{ shift.duration }}<br>
|
||||
{% if shift.event.calendar.restricted %}
|
||||
<strong>Nur Team:</strong> {{ shift.required_helpers|default:shift.room.required_helpers }}
|
||||
{% else %}
|
||||
<strong>Belegung:</strong> {{ shift.registration_count }}/{{ shift.required_helpers|default:shift.room.required_helpers }}
|
||||
{% endif %}
|
||||
{% if shift.checkin_count is not None %}
|
||||
<br>
|
||||
<strong>Checkin-Status:</strong> {% if shift.checkin_count >= shift.required_helpers|default:shift.room.required_helpers %}<span class="tag is-rounded is-success">vollständig</span>{% elif shift.checkin_count > 0 %}<span class="tag is-rounded is-warning">teilweise</span>{% else %}<span class="tag is-rounded is-danger">kein Checkin</span>{% endif %}
|
||||
|
|
|
@ -6,7 +6,12 @@
|
|||
<h3 class="title is-spaced">
|
||||
{% if shift.deleted %}(gelöscht) {% endif %}
|
||||
<a href="{% url 'team:shift_room' shift.room.name %}">{{ shift.room.name }}</a>
|
||||
{{ shift.start_at }} ({{ shift.registration_count }}/{{ shift.required_helpers|default:shift.room.required_helpers }})
|
||||
{{ shift.start_at }}
|
||||
{% if shift.event.calendar.restricted %}
|
||||
({{ shift.required_helpers|default:shift.room.required_helpers }} Teamis)
|
||||
{% else %}
|
||||
({{ shift.registration_count }}/{{ shift.required_helpers|default:shift.room.required_helpers }})
|
||||
{% endif %}
|
||||
</h3>
|
||||
{% if shift.room.description %}
|
||||
<div class="content">
|
||||
|
@ -53,10 +58,10 @@
|
|||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if shift.event.fallbackassignment_set.count > 0 %}
|
||||
{% if shift.fallbackassignment_set.count > 0 %}
|
||||
<h5 class="subtitle">Teammitglieder</h5>
|
||||
<div class="columns is-multiline">
|
||||
{% for fallback in shift.event.fallbackassignment_set.all %}
|
||||
{% for fallback in shift.fallbackassignment_set.all %}
|
||||
<div class="column is-one-quarter">
|
||||
<div class="box{% if fallback.was_full %} has-text-grey" style="text-decoration: line-through;{% endif %}">
|
||||
{% if fallback.traded_to %}
|
||||
|
@ -69,6 +74,7 @@
|
|||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if not shift.event.calendar.restricted %}
|
||||
<h5 class="subtitle">Helfi eintragen</h5>
|
||||
<form action="" method="post">
|
||||
{% csrf_token %}
|
||||
|
@ -97,4 +103,5 @@
|
|||
{% endfor %}
|
||||
<button class="button is-link" type="submit">Hinzufügen</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -45,17 +45,9 @@ def shift_overview(request):
|
|||
context = {}
|
||||
context["running_shifts"] = (
|
||||
Shift.all_objects.with_reg_count()
|
||||
.prefetch_related("event__calendar")
|
||||
.select_related("event__calendar")
|
||||
.annotate(
|
||||
checkin_count=Count(
|
||||
Case(
|
||||
When(
|
||||
shiftregistration__state=ShiftRegistration.RegState.CHECKED_IN,
|
||||
then=1,
|
||||
),
|
||||
output_field=models.IntegerField(),
|
||||
)
|
||||
),
|
||||
checkin_count=checkin_count,
|
||||
end_at=ExpressionWrapper(
|
||||
F("start_at") + F("duration"), output_field=DateTimeField()
|
||||
),
|
||||
|
@ -66,7 +58,7 @@ def shift_overview(request):
|
|||
|
||||
context["next_shifts"] = (
|
||||
Shift.all_objects.with_reg_count()
|
||||
.prefetch_related("event__calendar")
|
||||
.select_related("event__calendar")
|
||||
.annotate(checkin_count=checkin_count)
|
||||
.filter(
|
||||
start_at__gt=timezone.now(),
|
||||
|
@ -81,7 +73,7 @@ def shift_overview(request):
|
|||
lambda x: x is not None,
|
||||
(
|
||||
Shift.all_objects.with_reg_count()
|
||||
.prefetch_related("event__calendar")
|
||||
.select_related("event__calendar")
|
||||
.filter(room=room, start_at__gt=timezone.now(), deleted=False)
|
||||
.order_by("start_at")
|
||||
.first()
|
||||
|
@ -284,8 +276,7 @@ class CheckinList(LoginRequiredMixin, ListView):
|
|||
|
||||
def get_queryset(self):
|
||||
return (
|
||||
ShiftRegistration.objects.select_related("helper", "shift")
|
||||
.prefetch_related("shift__event__calendar")
|
||||
ShiftRegistration.objects.select_related("helper", "shift__event__calendar")
|
||||
.filter(shift__deleted=False, state=ShiftRegistration.RegState.REGISTERED)
|
||||
.order_by("shift__start_at", "shift__room__name")
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue