From f33c7c8bd7c121fc634dc985e796b181942606b3 Mon Sep 17 00:00:00 2001 From: Greensand321 Date: Sat, 10 Jan 2026 22:19:04 -0500 Subject: [PATCH] Fix duplicate preview default filters --- duplicate_consolidation.py | 44 ++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/duplicate_consolidation.py b/duplicate_consolidation.py index 5afd9a2..2a19f54 100644 --- a/duplicate_consolidation.py +++ b/duplicate_consolidation.py @@ -4058,6 +4058,33 @@ def _format_setting(value: object) -> str: html_lines.append(f"
{esc(_format_setting(value))}
") html_lines.extend(["", ""]) + actionable_groups = 0 + show_ready_default = False + show_no_ops_default = False + if plan.groups: + for group in plan.groups: + actions = _planned_actions(group) + visible_losers = list(group.losers) + hidden_losers: set[str] = set() + if not show_artwork_variants: + hidden_losers = { + loser for loser in group.losers if _is_artwork_variant(group, loser, art_threshold) + } + if hidden_losers: + visible_losers = [loser for loser in group.losers if loser not in hidden_losers] + actions = [ + act + for act in actions + if not (act["step"] == "loser_cleanup" and act["target"] in hidden_losers) + ] + if not show_artwork_variants and not actions and not visible_losers: + continue + if not _is_noop_group(actions): + actionable_groups += 1 + if actionable_groups == 0: + show_ready_default = True + show_no_ops_default = True + html_lines.extend( [ "", @@ -4071,9 +4098,11 @@ def _format_setting(value: object) -> str: "", "", "", + f" " + "Show ready groups", "", + f" " + "Show no-op groups", "Hides groups with no planned operations when off.", "", "
", @@ -4087,7 +4116,6 @@ def _format_setting(value: object) -> str: ) all_actions: List[Dict[str, object]] = [] - actionable_groups = 0 for group in plan.groups: actions = _planned_actions(group) visible_losers = list(group.losers) @@ -4107,8 +4135,6 @@ def _format_setting(value: object) -> str: continue is_noop = _is_noop_group(actions) all_actions.extend(actions) - if not is_noop: - actionable_groups += 1 state = "review" if group.review_flags else "ready" badges = _action_badges(group, actions) group_disposition_count = sum( @@ -4411,8 +4437,12 @@ def _format_setting(value: object) -> str: html_lines.append("
") html_lines.append("") - if actionable_groups == 0: - html_lines.append("
No changes needed.
") + if not plan.groups: + html_lines.append("
No duplicate groups found.
") + elif actionable_groups == 0: + html_lines.append( + "
No planned changes. All groups are ready or no-op.
" + ) html_lines.append("") html_lines.append("
") html_lines.append("")