From e672488d50c6bd15572e551f155dbc869a43d21c Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 29 Apr 2026 00:15:13 +0000 Subject: [PATCH] fix: default Keep checkbox to algorithm-selected survivor only Only the row chosen by the survivor rule (first, last, most-recent, etc.) is checked by default. Other rows start unchecked. Co-Authored-By: Claude Opus 4.6 --- src/gui/components.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gui/components.py b/src/gui/components.py index df83466..0a54324 100644 --- a/src/gui/components.py +++ b/src/gui/components.py @@ -372,7 +372,7 @@ def match_group_card( # --- Undecided: interactive editor with inline checkboxes & dropdowns --- editor_rows = [] for idx in group.row_indices: - row_data = {"Keep": True, "Row": idx + 1} + row_data = {"Keep": idx == group.survivor_index, "Row": idx + 1} for col in display_cols: row_data[col] = str(df.iloc[idx].get(col, "")) editor_rows.append(row_data) @@ -441,7 +441,7 @@ def match_group_card( # Confirm def _on_confirm( g=gid, indices=list(group.row_indices), - diff=differing_cols, + diff=differing_cols, surv=group.survivor_index, ): editor_state = st.session_state.get(f"editor_{g}", {}) ed_rows = editor_state.get("edited_rows", {}) @@ -450,7 +450,8 @@ def match_group_card( keep = [] for i, idx in enumerate(indices): changes = ed_rows.get(i, {}) - if changes.get("Keep", True): + default_keep = idx == surv + if changes.get("Keep", default_keep): keep.append(idx) if not keep: keep = list(indices)