From df91526b0c6df206069a2b7a0eae70f5f4515561 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Tue, 5 Aug 2025 10:18:10 -0400 Subject: [PATCH] [videogames] Fix showing platform in logdata --- vrobbler/apps/videogames/models.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/vrobbler/apps/videogames/models.py b/vrobbler/apps/videogames/models.py index 8ad23fa..4e63503 100644 --- a/vrobbler/apps/videogames/models.py +++ b/vrobbler/apps/videogames/models.py @@ -24,18 +24,6 @@ BNULL = {"blank": True, "null": True} User = get_user_model() -@dataclass -class VideoGameLogData(BaseLogData, LongPlayLogData, WithPeopleLogData): - platform_id: Optional[int] = None - emulated: Optional[bool] = False - emulator: Optional[str] = None - - def platform(self): - if not self.platform_id: - return - return VideoGamePlatform.objects.filter(id=self.platform_id).first() - - class VideoGamePlatform(TimeStampedModel): name = models.CharField(max_length=255) uuid = models.UUIDField(default=uuid4, editable=False, **BNULL) @@ -51,6 +39,19 @@ class VideoGamePlatform(TimeStampedModel): ) +@dataclass +class VideoGameLogData(BaseLogData, LongPlayLogData, WithPeopleLogData): + platform_id: Optional[int] = None + emulated: Optional[bool] = False + emulator: Optional[str] = None + + @property + def platform(self) -> VideoGamePlatform | None: + if not self.platform_id: + return + return VideoGamePlatform.objects.filter(id=self.platform_id).first() + + class VideoGameCollection(TimeStampedModel): name = models.CharField(max_length=255) uuid = models.UUIDField(default=uuid4, editable=False, **BNULL)