prefetch more data for team view
This commit is contained in:
parent
7aa5da28fe
commit
0d2415aef2
|
@ -43,6 +43,7 @@ def shift_overview(request):
|
|||
context = {}
|
||||
context["running_shifts"] = (
|
||||
Shift.with_reg_count()
|
||||
.prefetch_related("event__calendar")
|
||||
.annotate(
|
||||
checkin_count=Count(
|
||||
Case(
|
||||
|
@ -63,6 +64,7 @@ def shift_overview(request):
|
|||
|
||||
context["next_shifts"] = (
|
||||
Shift.with_reg_count()
|
||||
.prefetch_related("event__calendar")
|
||||
.annotate(checkin_count=checkin_count)
|
||||
.filter(
|
||||
start_at__gt=timezone.now(),
|
||||
|
@ -77,6 +79,7 @@ def shift_overview(request):
|
|||
lambda x: x is not None,
|
||||
(
|
||||
Shift.with_reg_count()
|
||||
.prefetch_related("event__calendar")
|
||||
.filter(room=room, start_at__gt=timezone.now(), deleted=False)
|
||||
.order_by("start_at")
|
||||
.first()
|
||||
|
|
Loading…
Reference in New Issue