diff --git a/src/aare/gui/models/user_sample_model.py b/src/aare/gui/models/user_sample_model.py index 5e1bc4de..2890a43c 100644 --- a/src/aare/gui/models/user_sample_model.py +++ b/src/aare/gui/models/user_sample_model.py @@ -165,9 +165,9 @@ class UserSampleSpreadsheet(QAbstractTableModel): @staticmethod def _measured(sample: SampleShortInfo) -> bool: - # Automatic status, never relabelled by hand: a sample counts as - # measured once its rotation count exceeds 1. - return isinstance(sample.rotation_count, (int, float)) and sample.rotation_count > 1 + # Automatic status, never relabelled by hand: any rotation data + # counts as measured (>= 1); unmeasured is exactly rotation count 0. + return isinstance(sample.rotation_count, (int, float)) and sample.rotation_count >= 1 def set_queued_ids(self, db_ids) -> None: self.queued_ids = set(db_ids) diff --git a/src/aare/gui/panels/tell_sample_panel.py b/src/aare/gui/panels/tell_sample_panel.py index 59f8a3db..de664539 100644 --- a/src/aare/gui/panels/tell_sample_panel.py +++ b/src/aare/gui/panels/tell_sample_panel.py @@ -178,11 +178,11 @@ class TellSamplePanel(QFrame): else: chip = QPushButton(label, self) if key == "measured": - chip.setToolTip("Filter measured samples (automatic: rotation count > 1)") + chip.setToolTip("Filter measured samples (automatic: rotation count ≥ 1)") elif key == "unmeasured": chip.setToolTip( - "Filter samples not yet measured — select all here to queue" - " everything still to be done" + "Filter samples with no rotation data yet — select all here to" + " queue everything still to be done" ) chip.setCheckable(True) chip.setChecked(key is None) diff --git a/tests/unit/gui/test_models.py b/tests/unit/gui/test_models.py index 6459d835..4daa177a 100644 --- a/tests/unit/gui/test_models.py +++ b/tests/unit/gui/test_models.py @@ -143,7 +143,8 @@ def _row_of(model, db_id): def status_model(sample_list): from aarecommon.models.models import DewarAddress, SampleShortInfo - # A measured sample: rotation_count > 1 (exactly 1 must NOT count). + # A measured sample: any rotation data counts (exactly 1 MUST count; + # unmeasured is rotation_count 0, like the fixture's samples 1-3). sample_list.append( SampleShortInfo( db_id=4, @@ -153,7 +154,7 @@ def status_model(sample_list): run_number=4, user="U1", pin=4, - rotation_count=2, + rotation_count=1, location=DewarAddress(segment="B", pos=1), ) ) @@ -180,7 +181,7 @@ def test_status_color_priority(status_model): model.set_queued_ids(set()) assert _status(model, _row_of(model, 1)) == SAMPLE_STATUS_FLAGGED_BG.lower() - # Measured is automatic: rotation_count 2 counts, the fixture's 1-3 don't. + # Measured is automatic: rotation_count 1 counts, the 0s of 1-3 don't. assert _status(model, _row_of(model, 4)) == SAMPLE_STATUS_MEASURED_BG.lower() assert _status(model, _row_of(model, 2)) is None