From 6b679152bc4ad9a1b1b95bb19be4f865f2eeed07 Mon Sep 17 00:00:00 2001 From: type-two Date: Tue, 23 Jun 2026 10:15:50 +1000 Subject: [PATCH] feat(nav): reorganize targets = picked crates sorted (editable) + per-crate landing summary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sources stay the pick-ordered crates; targets default to those same real crate IDs sorted ascending (4,3,2,1 โ†’ pour Aโ€“Z into 1,2,3,4), shown in an editable field so you can consolidate/spread. Plan now shows where items land per crate. Drops the Start+Count inputs (which could target non-existent crate IDs and orphan items). Co-Authored-By: Claude Opus 4.8 --- site/search.html | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/site/search.html b/site/search.html index f194bfa..7ff4136 100644 --- a/site/search.html +++ b/site/search.html @@ -408,10 +408,9 @@ function toolReorg(){ return `
๐ŸŽฏ Filters
Price โ‰ค Year
-
๐Ÿ“ฆ Distribution Target
-
Start - Count - Slots +
๐Ÿ“ฆ Distribution Target โ€” sorted Aโ€“Z, poured into these crates in order
+
Target crates + Slots/crate
@@ -432,7 +431,8 @@ async function reorgScan(){ ST.pick=ids; renderPick(); const d=await post('/nav/reorg/scan',{crate_ids:ids}); roItems=d.items||[]; $('#roScanOut').innerHTML=`${d.count} items ยท ${ids.length} crate(s)`; - $('#roStart').value=ids[0]; $('#roCount').value=ids.length; $('#roPlanArea').style.display='block'; + // targets default to the picked crates sorted ascending (4,3,2,1 โ†’ fill 1,2,3,4) โ€” editable + $('#roTargets').value=[...new Set(ids)].sort((a,b)=>a-b).join(', '); $('#roPlanArea').style.display='block'; } function roCmp(m){ return (a,b)=>{ if(m==='title') return (a.title||'').localeCompare(b.title||''); @@ -445,15 +445,19 @@ function reorgPlan(){ const pmax=parseFloat($('#roPmax').value)||null, ymin=parseInt($('#roYmin').value)||null, ymax=parseInt($('#roYmax').value)||null; let items=roItems.filter(i=> (pmax==null||(i.price!=null&&i.price<=pmax)) && (ymin==null||(i.year&&i.year>=ymin)) && (ymax==null||(i.year&&i.year<=ymax)) ); items.sort(roCmp($('#roSort').value)); - const start=parseInt($('#roStart').value), count=parseInt($('#roCount').value)||1, slots=parseInt($('#roSlots').value)||50; - const targets=[]; for(let i=0;i=targets.length){ roLeftovers.push(it); continue; } roMoves.push({sku:it.sku, new_crate_id:targets[ti], new_slot:slot, title:it.title, artist:it.artist, from:`${it.crate_id||'โ€”'}/${it.slot||'โ€”'}`}); slot++; if(slot>slots){ slot=1; ti++; } } - $('#roPlanOut').innerHTML=`
${roMoves.length} โ†’ crates ${targets.join(', ')}${roLeftovers.length?' ยท '+roLeftovers.length+' leftover':''}
` + const perT={}; roMoves.forEach(m=>perT[m.new_crate_id]=(perT[m.new_crate_id]||0)+1); + const summary=targets.map(t=>`${t}: ${perT[t]||0}`).join(' ยท '); + $('#roPlanOut').innerHTML=`
${roMoves.length} items${roLeftovers.length?' ยท '+roLeftovers.length+' leftover (need more crates)':''}
` + +`
into โ†’ ${summary}
` +'' +roMoves.slice(0,300).map(m=>``).join('') +(roMoves.length>300?``:'')+'
โ†’ Crate/SlotTitleArtistFrom
${m.new_crate_id} / ${m.new_slot}${esc(m.title||m.sku)}${esc(m.artist||'')}${esc(m.from)}
โ€ฆ+${roMoves.length-300} more
';