From c1b3493c808f08b52ebdd515d63f52f296e03ae3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Sat, 7 Sep 2024 23:35:59 +0200 Subject: [PATCH] Merge calculated and manual duration --- games/views/game.py | 9 ++------- games/views/session.py | 8 +------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/games/views/game.py b/games/views/game.py index 17efcba..c5ccf76 100644 --- a/games/views/game.py +++ b/games/views/game.py @@ -266,19 +266,14 @@ def view_game(request: HttpRequest, game_id: int) -> HttpResponse: sessions = session_page_obj.object_list session_data: dict[str, Any] = { - "columns": ["Date", "Duration", "Duration (manual)", "Actions"], + "columns": ["Date", "Duration", "Actions"], "rows": [ [ f"{local_strftime(session.timestamp_start)}{f" — {session.timestamp_end.strftime(timeformat)}" if session.timestamp_end else ""}", ( format_duration(session.duration_calculated, durationformat) if session.duration_calculated - else "-" - ), - ( - format_duration(session.duration_manual, durationformat_manual) - if session.duration_manual - else "-" + else f"{format_duration(session.duration_manual, durationformat_manual)}*" ), render_to_string( "cotton/button_group_sm.html", diff --git a/games/views/session.py b/games/views/session.py index 91049ed..7921d2d 100644 --- a/games/views/session.py +++ b/games/views/session.py @@ -50,7 +50,6 @@ def list_sessions(request: HttpRequest) -> HttpResponse: "Name", "Date", "Duration", - "Duration (manual)", "Device", "Created", "Actions", @@ -68,12 +67,7 @@ def list_sessions(request: HttpRequest) -> HttpResponse: ( format_duration(session.duration_calculated, durationformat) if session.duration_calculated - else "-" - ), - ( - format_duration(session.duration_manual, durationformat_manual) - if session.duration_manual - else "-" + else f"{format_duration(session.duration_manual, durationformat_manual)}*" ), session.device, session.created_at.strftime(dateformat),