Add emulated property to sessions
Some checks failed
Django CI/CD / test (push) Successful in 1m16s
Django CI/CD / build-and-push (push) Has been cancelled

This commit is contained in:
2025-01-29 13:43:35 +01:00
parent c2853a3ecc
commit ba6028e43d
10 changed files with 92 additions and 70 deletions

View File

@ -11,7 +11,7 @@ from common.components import (
A,
Button,
Icon,
LinkedNameWithPlatformIcon,
NameWithIcon,
PopoverTruncated,
)
from common.time import dateformat, local_strftime
@ -54,11 +54,7 @@ def list_editions(request: HttpRequest) -> HttpResponse:
],
"rows": [
[
LinkedNameWithPlatformIcon(
name=edition.name,
game_id=edition.game.id,
platform=edition.platform,
),
NameWithIcon(edition_id=edition.pk),
PopoverTruncated(
edition.name
if edition.game.name != edition.name

View File

@ -14,7 +14,7 @@ from common.components import (
Div,
Icon,
LinkedPurchase,
NameWithPlatformIcon,
NameWithIcon,
Popover,
PopoverTruncated,
PurchasePrice,
@ -67,18 +67,7 @@ def list_games(request: HttpRequest) -> HttpResponse:
],
"rows": [
[
A(
[
(
"href",
reverse(
"view_game",
args=[game.pk],
),
)
],
PopoverTruncated(game.name),
),
NameWithIcon(game_id=game.pk),
PopoverTruncated(
game.sort_name
if game.sort_name is not None and game.name != game.sort_name
@ -212,10 +201,7 @@ def view_game(request: HttpRequest, game_id: int) -> HttpResponse:
],
"rows": [
[
NameWithPlatformIcon(
name=edition.name,
platform=edition.platform,
),
NameWithIcon(edition_id=edition.pk),
edition.year_released,
render_to_string(
"cotton/button_group.html",
@ -321,13 +307,10 @@ def view_game(request: HttpRequest, game_id: int) -> HttpResponse:
"columns": ["Edition", "Date", "Duration", "Actions"],
"rows": [
[
NameWithPlatformIcon(
name=session.purchase.name
if session.purchase.name
else session.purchase.first_edition.name,
platform=session.purchase.platform,
NameWithIcon(
session_id=session.pk,
),
f"{local_strftime(session.timestamp_start)}{f"{local_strftime(session.timestamp_end, timeformat)}" if session.timestamp_end else ""}",
f"{local_strftime(session.timestamp_start)}{f'{local_strftime(session.timestamp_end, timeformat)}' if session.timestamp_end else ''}",
(
format_duration(session.duration_calculated, durationformat)
if session.duration_calculated

View File

@ -15,7 +15,7 @@ from common.components import (
Div,
Form,
Icon,
LinkedNameWithPlatformIcon,
NameWithIcon,
Popover,
)
from common.time import (
@ -130,12 +130,8 @@ def list_sessions(request: HttpRequest, search_string: str = "") -> HttpResponse
],
"rows": [
[
LinkedNameWithPlatformIcon(
name=session.purchase.first_edition.name,
game_id=session.purchase.first_edition.game.pk,
platform=session.purchase.platform,
),
f"{local_strftime(session.timestamp_start)}{f"{local_strftime(session.timestamp_end, timeformat)}" if session.timestamp_end else ""}",
NameWithIcon(session_id=session.pk),
f"{local_strftime(session.timestamp_start)}{f'{local_strftime(session.timestamp_end, timeformat)}' if session.timestamp_end else ''}",
(
format_duration(session.duration_calculated, durationformat)
if session.duration_calculated