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 sessions = session_page_obj.object_list
session_data: dict[str, Any] = { session_data: dict[str, Any] = {
"columns": ["Date", "Duration", "Duration (manual)", "Actions"], "columns": ["Date", "Duration", "Actions"],
"rows": [ "rows": [
[ [
f"{local_strftime(session.timestamp_start)}{f"{session.timestamp_end.strftime(timeformat)}" if session.timestamp_end else ""}", f"{local_strftime(session.timestamp_start)}{f"{session.timestamp_end.strftime(timeformat)}" if session.timestamp_end else ""}",
( (
format_duration(session.duration_calculated, durationformat) format_duration(session.duration_calculated, durationformat)
if session.duration_calculated if session.duration_calculated
else "-" else f"{format_duration(session.duration_manual, durationformat_manual)}*"
),
(
format_duration(session.duration_manual, durationformat_manual)
if session.duration_manual
else "-"
), ),
render_to_string( render_to_string(
"cotton/button_group_sm.html", "cotton/button_group_sm.html",

View File

@ -50,7 +50,6 @@ def list_sessions(request: HttpRequest) -> HttpResponse:
"Name", "Name",
"Date", "Date",
"Duration", "Duration",
"Duration (manual)",
"Device", "Device",
"Created", "Created",
"Actions", "Actions",
@ -68,12 +67,7 @@ def list_sessions(request: HttpRequest) -> HttpResponse:
( (
format_duration(session.duration_calculated, durationformat) format_duration(session.duration_calculated, durationformat)
if session.duration_calculated if session.duration_calculated
else "-" else f"{format_duration(session.duration_manual, durationformat_manual)}*"
),
(
format_duration(session.duration_manual, durationformat_manual)
if session.duration_manual
else "-"
), ),
session.device, session.device,
session.created_at.strftime(dateformat), session.created_at.strftime(dateformat),