Public: anyone can read this; the crew can change it.
forked from trevato/cs
The board lists the maps worth comparing: a bounded set of links, and the rule that chose them #425
Check · Review · Land · Live done — Landed and live in production.
Above the all-time board there is now a bounded list of map links: *every map*, *de_forge*, and the generated maps with at least `LISTED_RESULTS` (3) finished results, most played first. The list never has more than `LISTED_MAPS` (8) maps. Every link is `/?board=<name>`, the one being read carries `aria-current="page"`, and one line under the links states the rule ("Maps with at least 3 finished r…
shipped production is serving it deploy ae07c2d
Sign in to join this conversation.
Above the all-time board there is now a bounded list of map links: every map, de_forge, and the generated maps with at least
LISTED_RESULTS(3) finished results, most played first. The list never has more thanLISTED_MAPS(8) maps. Every link is/?board=<name>, the one being read carriesaria-current="page", and one line under the links states the rule ("Maps with at least 3 finished results, most played first — de_forge always, and at most 8 maps.").#419 had already drawn this nav, but with another rule: it counted players (at least 2), and it rebuilt the list on every page load by grouping the whole
standingtable. That table grows with every map ever generated. This pull replaces both.What changed
src/db.ts-
standinggets afinishedcount per player per map. - A new table,board_map (map, results), keeps one row per map with its number of finished results, plus an indexboard_map_by_results (results DESC, map).restandupdates each map's count by the change one player's write made, so it touches only that player's maps. A match that is re-posted under another map, a delete, and pruning at the table's ceiling all keep the count right. - An older database rebuildsstandingandboard_maponce, when it is opened. -boardMapsnow reads the top of that index: ``SEARCH board_map USING COVERING INDEX board_map_by_results (results>?)`` There is no sort step and no GROUP BY. It reads at most eight rows however many maps exist. With 20,000 matches on 200 maps it takes 0.016 ms, and the board read beside it takes 0.036 ms.src/pages/game.ts:boardsNavandlistedRuleare exported. If a link names a map that isn't listed, that map takes the last slot, so the list still never goes past eight and you can always get back to the board you're on.- A map at N finished results is listed and one below N is not. - Unfinished matches don't count. - The cap holds with and without an unlisted current map. - The current link is marked. - Every href is escaped and parses back through
playedOnto the map it names. - The count follows a re-post under another map, a delete, and a rebuild. - The query plan above is asserted. - #419's players-based test is replaced, because the rule it tested is gone.bun run testpasses: typecheck and 1766 tests.Not done: the list is not added to the terminal (#242 left the terminal's shape to #84), and nothing shows each map's count next to its link.
To try it: open
/?board=gen_ab12on the preview. The nav shows every map, de_forge and gen_ab12, with gen_ab12 marked as the current board. Finish three rounds on one generated map and it joins the list.🤖 Generated with Claude Code
Closes #416