Skip to content

fix(scanner): badge-scanner v2 — camera, real prize count, identity, claimed prizes, event stats (#badge-v2) - #2902

Merged
jung-thomas merged 7 commits into
DEVfrom
worktree-scanner-badge-v2
Oct 23, 2026
Merged

jung-thomas merged 7 commits into
DEVfrom
worktree-scanner-badge-v2

Conversation

@jung-thomas

Copy link
Copy Markdown
Contributor

Badge Scanner v2 — camera fix, real prize count, identity, claimed prizes, event stats

Fixes the Vue badge scanner (/scanner-vue/) and extends it to what an operator needs at the prize table.

What changed

  • Camera now opens — onScan awaits nextTick after switching to the scanning state so the <video> ref is mounted before the scanner reads it (was throwing "Video element not available" and tearing the camera down).
  • Real prize count — getContestant numeric fields coerced to 0; card shows a real N of 2, never null of 2.
  • Identity line — LastName, F. for eyeball-match against the badge. No email, no full first name crosses the wire (only last name + a single server-derived initial).
  • Claimed prize names — lists the names of prizes the contestant has claimed (DEV data: all CLAIMED records carry a real prize name).
  • Event-stats panel (per scan, under the card) — prizes handed over vs. catalog size, earned-awaiting-handover, participants/claimers, and completion totals. Scoped to the event on the badge (TaskRecords.event_ID).
  • Card completion counts are now event-scoped too, so the card and the event panel reconcile (previously the card was lifetime-wide).
  • claimPrizeForContestant fixed to POST — it's an OData action; the client was issuing a function-style GET (pre-existing bug).

Tests (TDD throughout)

  • test/unit/scanner-contestant-count.test.js — identity, blank-first-name, claimed names, event-scoped counts
  • test/unit/scanner-event-stats.test.js — aggregates, cross-event isolation, unresolvable-event zero shape
  • hugo-apps/src/scanner-vue/__tests__/ — camera ordering, null-count coercion, POST action contract
  • Full scanner suite: 36/36 pass (9 files), no regression in existing capped/ownership/auth tests.

Reviewer

Whole-branch review (opus): ship-able, 0 Critical / 0 Important.

Needs manual verification on DEV (can't be proven by unit tests)

  • Camera on a real device — the nextTick ordering is unit-tested, but the actual camera opening at /scanner-vue/ needs a physical badge on the DEV approuter.
  • "Record prize handover" — the POST fix should be tapped live once (the action path has no HTTP-level test; MobileApp mocked user isn't configured).

Notes / deferred minors

  • participants counts any completion task-type (incl. STEP/PUZZLE), matching the spec's type-agnostic "≥1 completion".
  • Pre-existing hugo-apps/tsconfig.json TS5101 baseUrl deprecation warning (untouched).

Design: docs/superpowers/specs/2026-10-23-badge-scanner-v2-design.md · Plan: docs/superpowers/plans/2026-10-23-badge-scanner-v2.md

…, claimed names, event stats

Probed DEV HANA (read-only): all 14,686 CLAIMED PrizeRecords carry a real
prize name (0 null); statuses are CLAIMED/EARNED only; 16-row Prizes catalog.
Folds builder-check resolutions in as calls. Awaiting approval before build.
…Contestant action (#badge-v2)

- getContestant completion counts now scoped to the scanned event (match the
  event-stats panel; falls back to all-events when eventId absent/unresolvable)
- claimPrizeForContestant invoked via POST with body params (it is an OData
  action, not a function) — fixes the pre-existing GET-vs-action mismatch
@jung-thomas
jung-thomas merged commit 60c2600 into DEV Oct 23, 2026
6 of 7 checks passed
@jung-thomas
jung-thomas deleted the worktree-scanner-badge-v2 branch October 23, 2026 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant