From f7e426e03092402adeae2e9477a93c7dd98746fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= <lukas@kucharczyk.xyz>
Date: Wed, 26 Mar 2025 12:04:46 +0100
Subject: [PATCH] Make it easier to create a play event

---
 games/views/playevent.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/games/views/playevent.py b/games/views/playevent.py
index e924d68..579fbae 100644
--- a/games/views/playevent.py
+++ b/games/views/playevent.py
@@ -115,6 +115,8 @@ def add_playevent(request: HttpRequest, game_id: int = 0) -> HttpResponse:
         # coming from add_playevent_for_game url path
         game = get_object_or_404(Game, id=game_id)
         initial["game"] = game
+        initial["started"] = game.sessions.earliest().timestamp_start
+        initial["ended"] = game.sessions.latest().timestamp_start
     form = PlayEventForm(request.POST or None, initial=initial)
     if form.is_valid():
         form.save()