Show the rankings in the browser (#16) #62
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
epic:E1-foundation
epic:E2-correct-metrics
epic:E3-fast-jobs
epic:E4-cli
epic:E5-web-ui
epic:E6-history
good first issue
help wanted
invalid
question
sprint-tracking
story
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
ckreidl/screener!62
Loading…
Reference in a new issue
No description provided.
Delete branch "16-rankings-table"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
🤖 Claude: Closes #16
bun run webserves the Magic Formula ranking as a sortable, filterable table on127.0.0.1:3000(setPORTto change it).How it works
src/server.ts:Bun.servewith an HTML import for/and/api/rankings. The JSON comes fromrankedFromDb, the same function that writes the CSV, read fresh on each request.web/table.ts: filtering, re-ranking (assignRanks, now shared withrank), sorting and the Stock Analysis link, without the DOM.web/app.tsdraws the page.rankDescis now O(n log n), because the page re-ranks on every filter change.tsconfig.jsongains theDOMlib. Two helpers inrefresh.test.tsnow type their zips asUint8Array<ArrayBuffer>to satisfy DOM'sBodyInit(no behavior change).Acceptance criteria
bun run webbinds127.0.0.1only, with no login. The test checks the hostname; on real data, the machine's LAN IP refuses connections. HTML imports serve the page.test/server.test.tscompares the API withrank()'s CSV. Real data: 1,391 rows in both, identical order.stockanalysis.com/stocks/<ticker>/and open in a new tab. Class suffixes use a dot. Checked in the browser:bf.b→ Brown-Forman,mog.a→ Moog (mog-ais a 404). These are the only two suffix tickers in the list.Definition of Done
bun testpasses (275 pass, 0 fail); new logic has tests (test/server.test.ts,test/table.test.ts)bun checkis clean (37 files) andbun fmt --checkpassescompany_facts.db, 1,391 eligible companies)🤖 Generated with Claude Code
🤖 Claude: Added browser tests for the page (Chris approved happy-dom as a dev dependency).
@happy-dom/global-registrator21.0.4.test/app.test.ts(11 tests): loadsweb/app.tsagainstindex.html's markup with/api/rankingsstubbed. It covers rows and number formatting, the prices line (including no enrich run yet), ticker links, sector chips, sector filters re-ranking, market-cap bounds in $M, Clear filters, header sorting both ways witharia-sort, and the error message when loading fails.fetchandResponse.app.tschanges:aria-sortis now set as an attribute, and checked sectors are read from.checked. happy-dom doesn't support theariaSortproperty, and after a form reset its:checkedselector still matched cleared boxes. Both changes behave the same in real browsers.bun test: 286 pass, 0 fail.bun checkandbun fmt --checkare clean.Review the following changes in direct dependencies. Learn more about Socket for GitHub.
Security
View full report
🤖 Claude: ## Code review
No issues found. Checked for bugs and CLAUDE.md compliance.