From c3ddd01a6f45bef76de6b19413e37e9df7e19183 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Sun, 21 Jan 2024 00:27:31 -0500 Subject: [PATCH] Default to getting a boardgame in the DB --- vrobbler/apps/boardgames/models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vrobbler/apps/boardgames/models.py b/vrobbler/apps/boardgames/models.py index c417db0..8738a9e 100644 --- a/vrobbler/apps/boardgames/models.py +++ b/vrobbler/apps/boardgames/models.py @@ -151,12 +151,12 @@ class BoardGame(ScrobblableMixin): cls, lookup_id: str, data: Optional[dict] = {} ) -> Optional["BoardGame"]: """Given a Lookup ID (either BGG or BGA ID), return a board game object""" - boardgame = None + boardgame = cls.objects.filter(bggeek_id=lookup_id).first() - if not data: + if not data or not boardgame: data = lookup_boardgame_from_bgg(lookup_id) - if data: + if data and not boardgame: boardgame, created = cls.objects.get_or_create( title=data["title"], bggeek_id=lookup_id )