feat: pick another batch-scan result (Closes #99) #101

Merged
jfro merged 7 commits from feat/batch-pick-result into main 2026-10-26 00:22:44 +00:00
Owner

Closes #99

Stacked on #98 (batch scanner Add Book tab); retarget to main after #98 merges.

Default pick (F6): an ISBN lookup now asks every provider and picks the best answer by a quality score (title, authors, pages, cover, description, ISBN match; placeholder/"Untitled" records score low), so an Open Library stub no longer beats a full Google record.

Pick another result: batch add returns the other providers' answers. Each added row in the scanner has an "Other results" list with a "Use this" button; a weak default gets a "Check match" badge, opens the list, and is flagged for metadata review. POST /books/:id/batch-pick re-fetches the chosen provider's record server-side (client data is never trusted) and applies it: 409 if it would duplicate another book, 422 for an unknown provider or failed lookup. Provider text is rendered with textContent only.

Logging: batch pick logs book id, provider, status and duration.

Tests: book_batch_pick_test.exs (swap, 409, 422, 404), quality score tests incl. Nye's F6 test; jsdom UI check (list, badge, pick POST, row update, no HTML injection). mix precommit: 720 passed.

Closes #99 Stacked on #98 (batch scanner Add Book tab); retarget to main after #98 merges. **Default pick (F6):** an ISBN lookup now asks every provider and picks the best answer by a quality score (title, authors, pages, cover, description, ISBN match; placeholder/"Untitled" records score low), so an Open Library stub no longer beats a full Google record. **Pick another result:** batch add returns the other providers' answers. Each added row in the scanner has an "Other results" list with a "Use this" button; a weak default gets a "Check match" badge, opens the list, and is flagged for metadata review. `POST /books/:id/batch-pick` re-fetches the chosen provider's record server-side (client data is never trusted) and applies it: 409 if it would duplicate another book, 422 for an unknown provider or failed lookup. Provider text is rendered with textContent only. Logging: batch pick logs book id, provider, status and duration. Tests: book_batch_pick_test.exs (swap, 409, 422, 404), quality score tests incl. Nye's F6 test; jsdom UI check (list, badge, pick POST, row update, no HTML injection). `mix precommit`: 720 passed.
jfro added this to the v0.9.0 milestone 2026-10-25 23:11:53 +00:00
lookup_by_isbn took the first provider that answered, so Open Library's
pre-order placeholder ("Untitled 4212B" by "Ballantine") beat Google's
complete record for 9780399594212. Every provider is now asked at once
and the answers ranked by quality_score/2; lookup_best_by_isbn/2 also
returns the other answers for picking another one.
batch_add now reports the provider, score and the other providers'
answers, and flags a low-quality match for metadata review.
POST /books/:id/batch-pick re-fetches the chosen provider's record for the
book's ISBN and applies it (409 if it would duplicate another book).
Each added book lists the other providers' answers for its ISBN with a
'Use this' button that calls POST /books/:id/batch-pick and updates the row.
A weak default match gets a 'Check match' badge and opens the list.
Provider text is rendered with textContent only.
Merge origin/feat/batch-scanner-tab and origin/main into feat/batch-pick-result
All checks were successful
CI / test (pull_request) Successful in 47s
f1ded7f928
jfro changed target branch from feat/batch-scanner-tab to main 2026-10-25 23:21:52 +00:00
fix: offer the scan's original result after a pick (F8)
All checks were successful
CI / test (pull_request) Successful in 48s
0a3aed4500
jfro merged commit 3eb829b8e1 into main 2026-10-26 00:22:44 +00:00
jfro deleted branch feat/batch-pick-result 2026-10-26 00:22:44 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jfro/fuzzy_catalog!101
No description provided.