More game overview optimizations
Django CI/CD / test (push) Successful in 1m15s Details
Django CI/CD / build-and-push (push) Successful in 1m37s Details

This commit is contained in:
Lukáš Kucharczyk 2024-01-14 17:04:06 +01:00
parent 854e3cc54a
commit a765fd8d00
Signed by: lukas
SSH Key Fingerprint: SHA256:vMuSwvwAvcT6htVAioMP7rzzwMQNi3roESyhv+nAxeg
2 changed files with 4 additions and 2 deletions

View File

@ -57,7 +57,7 @@
</ul>
<h1 class="text-3xl mt-4 mb-1 flex gap-2 items-center">
Sessions
<span class="dark:text-slate-500">({{ sessions.count }})</span>
<span class="dark:text-slate-500">({{ session_count }})</span>
{% url 'start_game_session' game.id as add_session_link %}
{% include 'components/button.html' with title="Start new session" text="New" link=add_session_link %}
and Notes <span class="dark:text-slate-500">({{ sessions_with_notes_count }})</span>

View File

@ -170,7 +170,9 @@ def view_game(request, game_id=None):
.order_by("year_released")
)
sessions = Session.objects.filter(purchase__edition__game=game)
sessions = Session.objects.prefetch_related("device").filter(
purchase__edition__game=game
)
session_count = sessions.count()
playrange_start = sessions.earliest().timestamp_start.strftime("%b %Y")