fix: check for existing items
This commit is contained in:
parent
5120d13117
commit
5bac2211fe
1 changed files with 18 additions and 9 deletions
|
@ -178,19 +178,28 @@ def add_item_to_log(item_id: str, media_type: str, log: str) -> None:
|
||||||
raise Exception("No item found")
|
raise Exception("No item found")
|
||||||
|
|
||||||
if "books" == media_type:
|
if "books" == media_type:
|
||||||
new_item, log_to_delete = check_for_existing(
|
new_item = None
|
||||||
item["work"]["ol_id"], media_type, log
|
if "work" in "ol_id":
|
||||||
)
|
new_item, log_to_delete = check_for_existing(
|
||||||
|
item["work"]["ol_id"], media_type, log
|
||||||
|
)
|
||||||
|
|
||||||
if new_item is None:
|
if new_item is None:
|
||||||
new_item, log_to_delete = check_for_existing(item["ol_id"], media_type, log)
|
if "ol_id" in item:
|
||||||
|
new_item, log_to_delete = check_for_existing(item["ol_id"], media_type, log)
|
||||||
|
|
||||||
if new_item is None:
|
if new_item is None:
|
||||||
new_item, log_to_delete = check_for_existing(
|
if "isbn_13" in item:
|
||||||
item["isbn_13"], media_type, log
|
|
||||||
)
|
|
||||||
if new_item is None:
|
|
||||||
new_item, log_to_delete = check_for_existing(
|
new_item, log_to_delete = check_for_existing(
|
||||||
item["isbn_10"], media_type, log
|
item["isbn_13"], media_type, log
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if new_item is None:
|
||||||
|
if "isbn_10" in item:
|
||||||
|
new_item, log_to_delete = check_for_existing(
|
||||||
|
item["isbn_10"], media_type, log
|
||||||
|
)
|
||||||
|
|
||||||
item = new_item if new_item is not None else item
|
item = new_item if new_item is not None else item
|
||||||
|
|
||||||
if log in ["log", "current"]:
|
if log in ["log", "current"]:
|
||||||
|
|
Loading…
Reference in a new issue