fix(v1.1): item 5 — section counter keys off in-section events (2/2 -> 3/2 bug)
A card is decided only when a swipe event carries THIS section's id; the lifetime swipes.action a second look wears into its section no longer paints it as pre-decided. progress/undecided, report counts (latest in-section event per listing) and maybe_exhaust all use the new section_decided_ids() set; read path only, no writes. Every section_state item carries decided_this_section; the FE counts server truth unless a local intent is in flight, and sectDecided is clamped to sectTotal everywhere (commit + paintSect) so the pill can never read past N/N. Semantics note: completing a section now means striking EVERY item in it (returns re-struck on their second look) — the exhaust selfcheck was updated to strike all items, matching the deck's real flow. Undo-on-a- return residual (event stays after the DELETE) is the accepted Q5 clamp- only behavior, covered by a dedicated selfcheck case.
This commit is contained in:
@@ -686,7 +686,7 @@ function commit(el,dir){
|
||||
const act= dir==='maybe'?'maybe':dir;
|
||||
setDecision(t.d.id, act, (!legacyMode&§ion&&!section.exhausted)?section.section.id:null,
|
||||
nPhotos(t.d)>1?(t.cur||0):null); // B1: photo on screen at strike
|
||||
sectDecided++;
|
||||
sectDecided=Math.min(sectTotal, sectDecided+1); // clamp: never past the total
|
||||
paintSect();
|
||||
flyOut(el,dir);
|
||||
fillPile(); relayer();
|
||||
@@ -1175,7 +1175,7 @@ let sectDecided=0, sectTotal=0;
|
||||
function paintSect(){
|
||||
const t=$('sect');
|
||||
if(legacyMode||!section){ t.textContent=''; return; }
|
||||
t.textContent=`${sectDecided}/${sectTotal}`;
|
||||
t.textContent=`${Math.min(sectDecided,sectTotal)}/${sectTotal}`; // clamp: never paints past the total
|
||||
t.classList.toggle('hot',sectDecided>=sectTotal);
|
||||
}
|
||||
function paintMode(){
|
||||
@@ -1194,7 +1194,10 @@ function updateSectionUI(body){
|
||||
let decided=0;
|
||||
for(const it of (body.items||[])){
|
||||
const local=localDecisions.get(it.id);
|
||||
if(local===undefined? it.decision!=null : local!=null) decided++;
|
||||
// item 5: server truth = decided DURING this section (an in-section
|
||||
// event), never the lifetime decision a second look wears into it;
|
||||
// local intent wins while a swipe's POST is in flight
|
||||
if(local===undefined? !!it.decided_this_section : local!=null) decided++;
|
||||
}
|
||||
sectDecided=decided;
|
||||
paintSect();
|
||||
|
||||
Reference in New Issue
Block a user