Skip to content

feat: ターム制と参加回数カウント(30分ルール・会場全体集計)#33

Merged
ut42tech merged 7 commits into
developfrom
feat/participation-count-terms
May 29, 2026
Merged

feat: ターム制と参加回数カウント(30分ルール・会場全体集計)#33
ut42tech merged 7 commits into
developfrom
feat/participation-count-terms

Conversation

@ut42tech
Copy link
Copy Markdown
Owner

概要

tec-nova Nagasaki の運営方針(ターム制・参加回数)をシステムに落とし込む。会場の時間帯(朝 9–12 / 昼 13–16 / 夕方 16–19)を「ターム」として扱い、参加日数ではなく参加回数(朝+昼に来れば2回)で数える。ターム終了まで残り30分未満の来場は参加回数に数えない(チェックイン/アウト自体は実施)。

設計判断(事前確認済み)

  • カウント方式 = 都度計算(derive): DBスキーマ変更なし。checked_in_at から共有ロジックでターム・カウント可否を算出。checked_in_at は必ず存在するため過去分も欠損なく分類できる。
  • 集計 = 参加者ごと+会場全体: プロフィール表示に加え、admin に全体集計ビューを新設。
  • タームの締め = 手動: 受付りれき画面の既存「滞在中全員をチェックアウト」を流用(新規実装なし)。Cron自動化・会場スケジュール設定は Phase 1.5 以降(docs に明記)。

設計の根拠は docs/requirements.md §5.4 / docs/mvp.md §4.4 を参照。

変更(コミット単位)

  1. docs: ターム制・参加回数・30分ルール・全体集計の仕様を追記(requirements §5.4・用語集、mvp §4.4・API契約・既知の制約)
  2. feat: 共有 venue-schedule モジュール(classifyTerm / countsTowardParticipation / TERM_LABELS、Workers制約でIntlのみ・UTC+9固定)
  3. feat: 共有スキーマ拡張(participationCount・per-session term/counted・participation summary)
  4. feat: 参加者プロフィールAPIで参加回数を都度計算((開催日,ターム) で重複排除)。visitCount は後方互換で維持
  5. feat: GET /api/stats/participation 会場全体集計(ターム別・日別、期間フィルタ)
  6. feat: checkin 受付UI(来場回数→参加回数、ターム/「カウント対象外」バッジ)
  7. feat: admin 集計ページ+ダッシュボードのタームバッジ+ナビ追加

検証

項目 結果
pnpm type-check(全6パッケージ) ✅ 6/6
pnpm biome check . ✅ 101 files / No fixes
venue-schedule 純粋ロジック(境界・TZ・30分) ✅ 33/33(type-stripping スクラッチ)
wrangler deploy --dry-run(Workerバンドル) ✅ 成功

⚠️ 未検証(手動確認が必要)

認証付きの実ランタイムE2E(ログイン済みセッション+シードデータを通したHTTP応答・ブラウザ描画)は未実施。OAuthセッションが必要でヘッドレス自動化不可。手元での確認手順:

pnpm --filter @tecnova/api db:apply:local
pnpm dev   # api:8787 / checkin:3000 / admin:3001
# admin「集計」ページ、参加者詳細の参加回数、
# checkin で 朝IN→全員チェックアウト→午後IN で参加回数+1 を確認

補足

  • テストランナーは未導入のまま(リポジトリ方針)。純粋ロジックはスクラッチ検証で担保し恒久テストは追加せず。
  • 既知リスク(docs記載): 12:00の全員チェックアウト押し忘れ時、午後の再スキャンがチェックアウト扱いになる(再スキャンで復帰)。運用ルールで回避。

🤖 Generated with Claude Code

ut42tech and others added 7 commits May 29, 2026 14:58
…ue-wide aggregation

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… counting rule

Pure, Workers-safe (Intl only) logic shared by API and frontends. Terms: morning 9-12 / afternoon 13-16 / evening 16-19 (JST). countsTowardParticipation applies the 'arrived <30min before term end is not counted' rule.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…n summary

Adds stats.participationCount plus per-session term/counted to the profile response, and participationSummaryQuery/Response for the venue-wide aggregation endpoint.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…profile API

fetchParticipantProfile joins events for the JST date, classifies each session's term, applies the 30-min rule, and counts distinct (date, term) pairs. visitCount is kept for backward compatibility.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Aggregates participation counts by term and date over an optional date range. Counting (the 30-min rule) cannot be expressed in SQL, so candidate sessions are fetched and deduped per (date, term, participant) in JS.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…n UI

Profile shows 参加回数 (participationCount) and tags each session with its term and a カウント対象外 badge when the 30-min rule excludes it; today's history derives term client-side.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
New 集計 page renders KPI cards and a per-date/per-term table from /api/stats/participation. Participant detail shows 参加回数; dashboard gains a term column; nav gets a 集計 link.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 29, 2026

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

Project Deployment Actions Updated (UTC)
tecnova-platform-admin Ready Ready Preview, Comment May 29, 2026 6:00am
tecnova-platform-checkin Ready Ready Preview, Comment May 29, 2026 6:00am

@ut42tech ut42tech merged commit 7e6ac2e into develop May 29, 2026
4 checks passed
@ut42tech ut42tech deleted the feat/participation-count-terms branch May 29, 2026 06:03
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