[boardgames] Fix bug when expansion has no image

This commit is contained in:
2026-07-04 10:09:55 -04:00
parent 8f97131b8d
commit 98d4e8bacb
2 changed files with 8 additions and 3 deletions

View File

@ -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 Fix bug when expansions have no image :boardgames:bug:
:PROPERTIES:
:ID: 9fee96c9-c6a0-32d9-b6f8-212c60fc3540
:END:
* Version 59.0 [3/3]
** DONE [#A] Add BoardGameVariant model :boardgames:
:PROPERTIES:

View File

@ -416,11 +416,12 @@ class BoardGame(ScrobblableMixin):
categories = bgg_data.pop("categories", [])
publishers = bgg_data.pop("publishers", [])
publisher = bgg_data.pop("publisher", [])
cover_url = bgg_data.pop("cover_url")
cover_url = bgg_data.pop("cover_url") or ""
game = cls.objects.create(**bgg_data)
game.save_image_from_url(cover_url)
if cover_url:
game.save_image_from_url(cover_url)
game.cooperative = data.get("cooperative", False)
game.highest_wins = data.get("highestWins", True)
game.no_points = data.get("noPoints", False)