frontend: fix second-look returns filtered out of the swipe buffer (decision===null filter dropped them; returns must enter the deck to be re-struck)
This commit is contained in:
@@ -543,7 +543,9 @@ async function loadSection(){
|
||||
const body=await res.json();
|
||||
section=body;
|
||||
const live=new Set([...pile.map(c=>c.d.id),...hist.map(h=>h.id),...buffer.map(b=>b.id)]);
|
||||
const fresh=(body.items||[]).filter(it=>it.decision===null&&!live.has(it.id));
|
||||
/* P3: second-look returns carry prior decisions — they must still enter
|
||||
the swipe buffer; only ids already handled in this session are skipped. */
|
||||
const fresh=(body.items||[]).filter(it=>(it.decision===null||it.slot==='return')&&!live.has(it.id));
|
||||
buffer.push(...fresh);
|
||||
fillPile();
|
||||
updateSectionUI(body);
|
||||
@@ -969,7 +971,8 @@ $('btnForge').onclick=async()=>{
|
||||
?'Agent offline — forging on the last read.':'';
|
||||
section=body;
|
||||
buffer.length=0;
|
||||
const fresh=(body.items||[]).filter(it=>it.decision===null);
|
||||
const live=new Set([...pile.map(c=>c.d.id),...hist.map(h=>h.id)]);
|
||||
const fresh=(body.items||[]).filter(it=>(it.decision===null||it.slot==='return')&&!live.has(it.id));
|
||||
buffer.push(...fresh);
|
||||
fillPile();
|
||||
updateSectionUI(body);
|
||||
|
||||
Reference in New Issue
Block a user