diff --git a/bricktracker/rebrickable_set.py b/bricktracker/rebrickable_set.py index 5a1c41f..23072d3 100644 --- a/bricktracker/rebrickable_set.py +++ b/bricktracker/rebrickable_set.py @@ -52,8 +52,8 @@ class RebrickableSet(BrickRecord): if record is not None: self.ingest(record) - # Import the set from Rebrickable - def download_rebrickable(self, /) -> None: + # Insert the set from Rebrickable + def insert_rebrickable(self, /) -> bool: # Insert the Rebrickable set to the database rows, _ = self.insert( commit=False, @@ -61,10 +61,14 @@ class RebrickableSet(BrickRecord): override_query=RebrickableSet.insert_query ) - if rows > 0: + inserted = rows > 0 + + if inserted: if not current_app.config['USE_REMOTE_IMAGES']: RebrickableImage(self).download() + return inserted + # Ingest a set def ingest(self, record: Row | dict[str, Any], /): super().ingest(record) diff --git a/bricktracker/set.py b/bricktracker/set.py index f16ea6f..cdd5678 100644 --- a/bricktracker/set.py +++ b/bricktracker/set.py @@ -54,7 +54,7 @@ class BrickSet(RebrickableSet): self.insert(commit=False) # Execute the parent download method - self.download_rebrickable() + self.insert_rebrickable() # Load the inventory RebrickableParts(self.socket, self).download()