From d5d0eb6cd89b3f5feb200dbb5bb017a751a6772a Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Sun, 5 Jul 2026 00:15:26 -0400 Subject: [PATCH] [boardgames] Make sure variants are filtered by game --- PROJECT.org | 6 +++++- vrobbler/apps/scrobbles/views.py | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/PROJECT.org b/PROJECT.org index 4997f36..85646f3 100644 --- a/PROJECT.org +++ b/PROJECT.org @@ -88,7 +88,7 @@ fetching and simple saving. *** Metadata sources **** Scraper -* Backlog [0/24] :vrobbler:project:personal: +* Backlog [1/25] :vrobbler:project:personal: ** TODO [#C] After transition to linux add curl_cffi as webpage scrapper again :webpages:metadata: ** TODO [#C] Create small utility to clean up tracks scrobbled with wonky playback times :bug:music:scrobbles: :PROPERTIES: @@ -619,6 +619,10 @@ The Edit log form should have from top to bottom: - Expansion ids (which should a multi-select widget of expansions for this game) - Location (which should be a drop down of BoardGameLocations for this user) +** DONE [#A] Fix bug where all variants for board games are in form :boardgames: +:PROPERTIES: +:ID: 9c4cd193-580a-5b33-8832-1feffea7bd53 +:END: * Version 59.4 [2/2] ** DONE Fix bug in fetching expansions for board games :boardgames: :PROPERTIES: diff --git a/vrobbler/apps/scrobbles/views.py b/vrobbler/apps/scrobbles/views.py index fe2a782..5e665e2 100644 --- a/vrobbler/apps/scrobbles/views.py +++ b/vrobbler/apps/scrobbles/views.py @@ -51,6 +51,7 @@ from music.aggregators import ( scrobble_counts, week_of_scrobbles, ) +from boardgames.models import BoardGame, BoardGameVariant from pendulum.parsing.exceptions import ParserError from profiles.models import UserProfile from profiles.utils import now_user_timezone @@ -1236,8 +1237,6 @@ class ScrobbleDetailView(DetailView): return self.object.media_obj.logdata_cls().form() def _update_board_game_widgets(self, form): - from boardgames.models import BoardGame - if not isinstance(self.object.media_obj, BoardGame): return @@ -1248,6 +1247,9 @@ class ScrobbleDetailView(DetailView): form.fields["expansion_ids"].queryset = expansions if "variant_ids" in form.fields: + form.fields["variant_ids"].queryset = BoardGameVariant.objects.filter( + board_game=self.object.media_obj + ) form.fields["variant_ids"].widget.attrs["data-board-game-id"] = ( self.object.media_obj.id ) @@ -1957,8 +1959,6 @@ class EmbeddableTopBoardGamesWidget(BaseEmbeddableWidget): scrobble_filter = {"scrobble__played_to_completion": True} def get_items(self, user, start_date, end_date): - from boardgames.models import BoardGame - return super().get_items(user, start_date, end_date, BoardGame)