Rename download_rebrickable to insert_rebrickable and make it return if an insertion occured
This commit is contained in:
parent
fa44b31f51
commit
35208fec8a
@ -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)
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user