fix: measured threshold is rotation count >= 1
Confirmed by Dawn: any rotation data counts as measured; unmeasured is exactly rotation count 0. The old > 1 rule left single-rotation samples looking like still-to-do work in the Unmeasured view. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user