From 5d50c8baaf69e4a9e58667ab85dfb1edc1469edd Mon Sep 17 00:00:00 2001 From: Giorgio Gilestro Date: Fri, 1 May 2026 14:33:11 +0100 Subject: [PATCH] =?UTF-8?q?Picker:=20relabel=20"bad=20ROIs"=20=E2=86=92=20?= =?UTF-8?q?"only=20ROIs"=20in=20user-facing=20strings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both the annotation-bar tooltip and the post-submit flash message now show the positive sense ("only ROIs 2,4,6") instead of the negative ("bad ROIs 1,3,5"). The CSV column stays bad_rois — the flip is purely cosmetic. Co-Authored-By: Claude Opus 4.7 --- scripts/barrier_picker_app/static/index.html | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/barrier_picker_app/static/index.html b/scripts/barrier_picker_app/static/index.html index 8742fd4..f2e5bdc 100644 --- a/scripts/barrier_picker_app/static/index.html +++ b/scripts/barrier_picker_app/static/index.html @@ -288,6 +288,15 @@ progress.textContent = `${done}/${queue.length} done`; } + // Reason: the CSV stores `bad_rois` (those that didn't open). The + // user-facing label flips this to the positive sense — "only ROIs X" + // are the usable ones. Empty bad_rois means all ROIs are usable. + function onlyRoisFromBad(badStr) { + if (!badStr) return ''; + const bad = new Set(String(badStr).split(',').map(s => parseInt(s.trim()))); + return [1,2,3,4,5,6].filter(r => !bad.has(r)).join(','); + } + function renderAnnotationBar(item) { const bar = document.getElementById('annotation-bar'); bar.innerHTML = ''; @@ -326,7 +335,8 @@ tooltip.className = 'mark-tooltip'; const m = Math.floor(ex.opening_s / 60); const s = (ex.opening_s % 60).toFixed(1); - const tag = ex.bad_rois ? ` · bad ROIs ${ex.bad_rois}` : ''; + const only = onlyRoisFromBad(ex.bad_rois); + const tag = only ? ` · only ROIs ${only}` : ''; const who = ex.analyst ? ` · ${ex.analyst}` : ''; tooltip.textContent = `${m}:${s.padStart(4,'0')}${who}${tag}`; // Position tooltip; if mark is near right edge, anchor right. @@ -422,11 +432,11 @@ item.done = true; updateProgress(); const t = result.row.opening_s; - const bad = result.row.bad_rois; + const only = onlyRoisFromBad(result.row.bad_rois); showFlash( `saved ${item.machine_name} ${item.session_date} ${item.session_time}: ` + (Number.isNaN(t) || t === null ? 'unusable' : - `${t.toFixed(1)}s${bad ? ' (bad ROIs: ' + bad + ')' : ''}`) + `${t.toFixed(1)}s${only ? ' (only ROIs ' + only + ')' : ''}`) ); } else if (result.status === 'skipped') { showFlash(`skipped ${item.machine_name} ${item.session_date} ${item.session_time}`);