Skip to content

feat(admin): correct check-in records from the admin dashboard and detail sheet - #52

Merged
ut42tech merged 27 commits into
developfrom
feat/admin-session-correction
Oct 11, 2026
Merged

ut42tech merged 27 commits into
developfrom
feat/admin-session-correction

Conversation

@ut42tech

Copy link
Copy Markdown
Owner

⚠️ #51(その下に #50)のブランチに積んでいる(docs/mvp.md・docs/handoff.md を共有しているため)。#50 → #51 の順にマージしてからマージする。

概要

受付の操作ミス(チェックイン忘れ・チェックアウト忘れ・別の子で受付・二重記録)を訂正できるよう、admin ロールが管理画面から来場記録を追加・編集・削除できるようにする。入口はダッシュボード(日付ごとの一覧)と利用者詳細(子どもごとの来場履歴)の 2 か所。

  • 設計書: docs/superpowers/specs/2026-10-11-checkin-record-correction-design.md
  • 実装計画: docs/superpowers/plans/2026-10-11-checkin-record-correction.md

変更内容

  • shared:JST ⇔ UTC 変換、来場記録のルール(session-rules.ts:退場は入場より後・同じ日・未来不可・滞在中は今日だけ・同じ子の重なり禁止)、リクエストの Zod スキーマ(2020 年以降に限定)
  • API:POST / PATCH / DELETE /api/sessions(admin のみ。GET は従来どおり全メンター)
    • 開催日は入場時刻の JST 日付から決め、無ければ作る。記録が無くなった過去の開催日は消す(今日は残す)
    • D1 にトランザクションが無いため、開催日の作成・記録の書き込み・空の開催日の削除を 1 回の db.batch にまとめる
    • 無効化した子の記録も対象にできる。受付経路(check-in / scan / 一括チェックアウト)は変更なし
  • API テスト基盤:@cloudflare/vitest-plugin@1.2.8 + vitest@4.1.11。ローカル D1 にマイグレーションを当てて lib を直接テスト(pnpm --filter @tecnova/api test)
  • admin:記録フォーム(子どもの検索・付け替え、日付・入場・退場、今日だけ「まだ滞在中」、その場の検証)、削除確認、「…」メニュー。admin 以外には一切表示しない
  • ui:shadcn の dialog
  • docs:mvp.md(API・画面・既知の制約)、requirements.md、handoff.md、pre-pr-check と CLAUDE.md に API テストを追加

DB のテーブル構造は変えていない(マイグレーションなし)。

確認

  • @tecnova/shared テスト 60 件、@tecnova/api テスト 34 件(実 D1:追加・編集・削除・開催日の移動と削除・admin 以外は 403 など)すべて成功
  • pnpm lint / pnpm type-check / シークレット走査 成功
  • Playwright(API をモック):ダッシュボード 11 項目(PC・スマホ・admin 以外)、利用者詳細 4 項目すべて成功。コンソールエラーなし
  • workers-constraint-reviewer / privacy-reviewer:違反なし
  • ブランチ全体のコードレビューを実施し、指摘のうち 3 件(猶予内の滞在中が 2 件になる・編集で触っていない時刻の秒が落ちる・年の打ち間違い)を修正済み

見送った軽微な指摘(今後の改善候補)

  • 選択中の過去日の最後の記録を消すと、日付の選択欄が空表示になる
  • 編集と削除が同時に走ると、空の過去の開催日が残ることがある
  • スマホのカードで「…」を押すとカード全体が押下色になる
  • 削除が 404 だったとき、一覧の古い行が残る
  • 日付の切り替え中、前の日付の行が一瞬残る

未確認

  • 本番 D1 での動作は本番反映後に確認する

Closes #48
Closes #49

🤖 Generated with Claude Code

ut42tech and others added 27 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>
…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>
Admins need to add, edit, and delete check-in records from the admin
dashboard and the participant detail sheet to fix reception mistakes
(forgotten check-ins/outs, wrong child, duplicates). The spec pins the
invariants the DB does not enforce (event derived from check-in date,
no overlaps, open sessions only today, empty past events removed), the
three admin-only endpoints, shared validation, UI, and the new
vitest-pool-workers tests for the API.

Refs #48, #49

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er as is

@cloudflare/vitest-pool-workers was renamed to @cloudflare/vitest-plugin
(the old name is deprecated); pin versions published at least two weeks
ago. Event creation now happens inside the write batch, so generalising
getOrCreateTodayEvent is no longer needed and the reception path stays
untouched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Thirteen tasks: docs first, shared rules and schemas (TDD), Workers
vitest integration, admin session lib (create/update/delete) and
admin-only routes with D1-backed tests, the shadcn dialog, admin form
components, then dashboard and detail-sheet wiring verified with
Playwright against a mocked API.

Refs #48, #49

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #48, #49

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #48, #49

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #48, #49

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An open target whose check-in was within the 1-minute future tolerance
formed an empty interval and slipped past an existing open session,
allowing two open sessions for one child.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A two-digit year typed into a date picker produced 1926 (or unpadded
year) events that broke the YYYY-MM-DD event date invariant.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rebuilding untouched times from HH:mm dropped their seconds, which could
raise false OVERLAP or CHECKOUT_BEFORE_CHECKIN errors. Untouched times
now keep their original instants, PATCH carries only changed fields,
and the date input gets the same 2020-01-01 lower bound as the API.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 10:41am UTC
tecnova-platform-checkin Ready Ready Preview Oct 11, 2026 10:41am UTC
tecnova-platform-signage Ready Ready Preview Oct 11, 2026 10:41am UTC

@ut42tech
ut42tech merged commit 1912561 into develop Oct 11, 2026
5 checks passed

This branch was successfully deployed

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