Merge calculated and manual duration
Django CI/CD / test (push) Successful in 1m2s Details
Django CI/CD / build-and-push (push) Successful in 1m55s Details

This commit is contained in:
Lukáš Kucharczyk 2024-09-07 23:35:59 +02:00
parent a1df8720f5
commit c1b3493c80
Signed by: lukas
SSH Key Fingerprint: SHA256:vMuSwvwAvcT6htVAioMP7rzzwMQNi3roESyhv+nAxeg
2 changed files with 3 additions and 14 deletions

View File

@ -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",

View File

@ -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),