simplify playtime range display
This commit is contained in:
		| @ -1,3 +1,8 @@ | ||||
| ## Unreleased | ||||
|  | ||||
| ### Improved | ||||
| * game overview: simplify playtime range display | ||||
|  | ||||
| ## 1.3.0 / 2023-11-05 15:09+01:00 | ||||
|  | ||||
| ### New | ||||
|  | ||||
| @ -15,9 +15,7 @@ | ||||
|         <h2 class="text-lg my-2 ml-2"> | ||||
|             {{ total_hours }} <span class="dark:text-slate-500">total</span> | ||||
|             {{ session_average }} <span class="dark:text-slate-500">avg</span>  | ||||
|             ({{ first_session.timestamp_start | date:"M Y"}} | ||||
|              —  | ||||
|             {{ last_session.timestamp_start | date:"M Y"}}) </h2> | ||||
|             ({{ playrange }}) </h2> | ||||
|         <hr class="border-slate-500"> | ||||
|         <h1 class="text-3xl mt-4 mb-1">Editions <span class="dark:text-slate-500">({{ editions.count }})</span></h1> | ||||
|         <ul> | ||||
|  | ||||
| @ -137,8 +137,15 @@ def view_game(request, game_id=None): | ||||
|     # here first and last is flipped | ||||
|     # because sessions are ordered from newest to oldest | ||||
|     # so the most recent are on top | ||||
|     context["last_session"] = context["sessions"].first() | ||||
|     context["first_session"] = context["sessions"].last() | ||||
|     playrange_start = context["sessions"].last().timestamp_start.strftime("%b %Y") | ||||
|     playrange_end = context["sessions"].first().timestamp_start.strftime("%b %Y") | ||||
|  | ||||
|     context["playrange"] = ( | ||||
|         playrange_start | ||||
|         if playrange_start == playrange_end | ||||
|         else f"{playrange_start} — {playrange_end}" | ||||
|     ) | ||||
|  | ||||
|     context["sessions_with_notes"] = context["sessions"].exclude(note="") | ||||
|     request.session["return_path"] = request.path | ||||
|     return render(request, "view_game.html", context) | ||||
|  | ||||
		Reference in New Issue
	
	Block a user