WIP: Initial work on deduplicating the minifigures and parts #57

Draft
gregoo wants to merge 19 commits from gregoo/BrickTracker:master into master
2 changed files with 8 additions and 4 deletions
Showing only changes of commit 35208fec8a - Show all commits

View File

@ -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)

View File

@ -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()