Skip to content

Commit

Permalink
[74] fix for #2522 (#2523)
Browse files Browse the repository at this point in the history
  • Loading branch information
meisnate12 authored and actions-user committed Feb 25, 2025
1 parent 4581f42 commit 7ed4f97
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.1.0-build73
2.1.0-build74
16 changes: 6 additions & 10 deletions modules/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,15 @@ def run_operations(self):
logger.debug(f"Item Operation: {self.library.items_library_operation}")
logger.debug("")

def should_be_deleted(col_in, labels_in, configured_in, managed_in, less_in, ignore_smart_in):
def should_be_deleted(col_in, labels_in, configured_in, managed_in, less_in):
if all((x is None for x in [configured_in, managed_in, less_in])):
return False

less_check = not ignore_smart_in if col_in.smart else True
less_check = True
if less_in is not None:
if less_check:
col_count = col_in.childCount if col_in.childCount is not None else 0
less_check = col_count < less_in
logger.trace(f"{col_in.title} - collection size: {col_count} < less: {less_in}, DELETE: {less_check}")
else:
logger.trace(f"{col_in.title} - skipping size check: smart - {col_in.smart}, ignore_smart - {ignore_smart_in}")

col_count = col_in.childCount if col_in.childCount is not None else 0
less_check = col_count < less_in
logger.trace(f"{col_in.title} - collection size: {col_count} < less: {less_in}, DELETE: {less_check}")

managed_check = True
if managed_in is not None:
Expand Down Expand Up @@ -1133,7 +1129,7 @@ def get_batch_info(placement, total, display_attr, total_count, display_value=No
col = self.library.reload(col, force=True)
labels = [la.tag for la in self.library.item_labels(col)]

if should_be_deleted(col, labels, configured, managed, less, ignore_smart):
if should_be_deleted(col, labels, configured, managed, None if col.smart and ignore_smart else less):
try:
self.library.delete(col)
logger.info(f"{col.title} Deleted")
Expand Down

0 comments on commit 7ed4f97

Please sign in to comment.