Skip to content

fix(checkin): start the QR camera only when tapped to scan - #51

Merged
ut42tech merged 7 commits into
developfrom
fix/checkin-qr-on-demand-scan
Oct 11, 2026
Merged

ut42tech merged 7 commits into
developfrom
fix/checkin-qr-on-demand-scan

Conversation

@ut42tech

@ut42tech ut42tech commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

⚠️ #50 のブランチに積んでいる(docs/handoff.md を両方で触るため)。#50 を先にマージすると、この PR の差分は下の 3 コミットだけになる。

背景

受付 iPad を常駐させてトップ画面を開いたまましばらく置くと、カメラ映像は普通に動いているのに QR を読まなくなる。「カメラを再起動」を押すと読める、という現場からのフィードバック。

原因について

根本原因は特定できていない。見た目では区別できない候補が 2 つある。

  • @zxing/browser の連続読み取り(scan)は、解析用キャンバスを起動時の映像サイズで 1 度だけ作り、drawImage(video, 0, 0) で拡大縮小せずに描く。後から映像の解像度・向きが変わると、一部しか解析しなくなる
  • iPad Safari が、長時間動き続ける処理を止めたり間引いたりしている

どちらの場合でも「起動し直した直後は読める」ことは現場で確認できているので、毎回その状態から読み取る方式にした。

変更内容

  • 待機中はカメラを止め、カメラ欄全体を「タップしてQRを読み取る」ボタンにする
  • タップでカメラを起動し、従来どおり自動で読み取る。読めたら遷移、20 秒(SCAN_TIMEOUT_MS)読めなければカメラを止めて待機に戻る
  • カメラ起動に失敗したら待機に戻し、ボタン上にエラーを出す(もう一度タップで再試行)
  • 「カメラを再起動」は残す(現場で「すぐ読ませたいときに押す」使い方をしているため)。読み取り中でもカメラを起動し直し、20 秒のタイマーもリセットする。待機中に押すと読み取りを始める
  • 「カメラ切り替え」も残し、待機中に押すと読み取りも始める
  • docs/mvp.md §7.1.1 と docs/handoff.md を更新

読み取る形式(QR / バーコード)は変えていない(ドキュメント上「QR/バーコード」のネームカードを想定しているため)。

確認

Playwright で偽カメラ(canvas.captureStream に QR を描画)と /api/me のモックを使い、ブラウザ上で動作を確認した。

確認項目 変更前 変更後
開いた直後はカメラを起動せず、開始ボタンを出す ❌(すぐ起動) ✅
タップ → QR を読んで /reception/participants/26001 へ遷移 —(ボタンなし) ✅
20 秒読めないとカメラのトラックが止まり、待機に戻る — ✅
読み取り中に「カメラを再起動」→ カメラを起動し直し、古いトラックは止まる — ✅
コンソールのエラー・警告 — なし
  • 偽カメラの QR を変更前のコードで読めることも確認済み(テスト環境自体が正しく動いていることの確認)
  • pnpm lint / pnpm type-check / @tecnova/shared のテスト(31 件)すべて成功
  • 未確認:iPad Safari 実機での効果。マージ・本番反映後に現場で確かめる。再発した場合は ?debug=1 の診断パネルで切り分ける(docs/handoff.md に記載)

🤖 Generated with Claude Code

ut42tech and others added 6 commits October 11, 2026 14:12
The handoff was frozen at 2026-05-29 and still described participation
stats and the signage app as develop-only, although both (plus the admin
UI refresh and the checkin data-layer migration) have since shipped to
main. Rewrite it to reflect the current state: main == develop, signage
complete, open issues #39/#47/#48/#49 and Phase 1.5 as next candidates.

Also condense the completed fullName/grade release runbooks into a
reusable "sheet column change" trap (full text kept in git history),
add the runtime-smoke lesson from PR #44, and drop a real mentor email.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Operations changed: mentors no longer write activity logs, so children
record their own reflection and goal-setting, moving from paper to
digital (input method still undecided). CSV export is covered by the
daily D1 SQL dump, OCR is moot once records are digital, the teacher
sheet stays teacher-led, and offline support is dropped.

- Replace the mentor-app / 30-min grid plan with child self-recording
- Make check-in record correction (add/edit/delete) a near-term item
- Move dropped items to out-of-scope and add §3.5 summarising the review
- Supersede D3-D6/D10 and record the new decisions as D16-D19

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follow-up to the requirements revision so the other docs stop pointing
at the dropped mentor app and its activity-log pipeline.

- mvp.md: refresh the Phase 1.5+ list and known operational limits
  (paper records transcribed to Google Forms, no way yet to correct
  check-in mistakes)
- architecture.md: swap the mentor app / activity logs / OCR / R2 /
  CSV / offline sync / prior-year import nodes for child record input,
  on-hold masters, and the daily D1 SQL dump used for analysis
- CLAUDE.md: note apps/mentor is cancelled

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Point the next steps at check-in record correction (add/edit/delete,
#48/#49) and the QR scanner recognition complaint, and replace the old
Phase 1.5 list (mentor app, activity logs, CSV export) with the revised
plan.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reception iPad stays on the home screen for long stretches, and the
always-on scanner stops reading QR codes after a while even though the
preview keeps moving; pressing "restart camera" brings it back. Spec the
home scanner to start the camera only when tapped and to stop on success
or after 20 seconds, and record what is known about the root cause.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keeping the camera running made iPad Safari stop recognising QR codes
after the page sat idle, while the preview still looked live. The exact
cause is unconfirmed (zxing's continuous scan reuses a capture canvas
sized at start-up, and Safari may throttle long-running work), but a
freshly started camera reliably reads, so every scan now starts from
that state.

- Idle: camera off, the camera view becomes a "タップしてQRを読み取る" button
- Scanning: auto-detects as before; stops on success or after 20 s
- Camera errors fall back to idle with a retry hint on the button
- Drop the restart button; camera switch also starts scanning

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
tecnova-platform-admin Ready Ready Preview Oct 11, 2026 5:54am UTC
tecnova-platform-checkin Ready Ready Preview Oct 11, 2026 5:54am UTC
tecnova-platform-signage Ready Ready Preview Oct 11, 2026 5:54am UTC

…ning

Reception staff use "カメラを再起動" to get a stubborn QR read quickly,
so removing it was a regression. It now restarts the camera even while
scanning (also resetting the 20 s timeout), and starts scanning when
pressed from idle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was successfully deployed

3 active deployments
Preview – tecnova-platform-signage — 657d1d1f Deployed Oct 11, 2026 by vercel[bot]
Preview – tecnova-platform-admin — 657d1d1f Deployed Oct 11, 2026 by vercel[bot]
Preview – tecnova-platform-checkin — 657d1d1f Deployed Oct 11, 2026 by vercel[bot]
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