Skip to content

Enforce three-volunteer slot cap#98

Open
zzawook wants to merge 1 commit into
masterfrom
feat/enforce-slot-capacity-96
Open

Enforce three-volunteer slot cap#98
zzawook wants to merge 1 commit into
masterfrom
feat/enforce-slot-capacity-96

Conversation

@zzawook
Copy link
Copy Markdown
Collaborator

@zzawook zzawook commented May 22, 2026

Summary

  • Cap admin-created and bulk-created survey slots at three volunteers.
  • Align admin form controls, server actions, and the bulk-create edge function around the same 1..3 capacity rule.
  • Update admin action tests for the new cap.

Validation

  • npm test -- tests/lib/actions/admin-round-actions.test.ts
  • npm test -- tests/app/walk/page.test.tsx tests/app/walk/walk-detail-client.test.tsx tests/lib/actions/walk-actions.test.ts
  • npx eslint "lib/actions/admin-round-actions.ts" "app/(app)/admin/walks/walks-client.tsx" "supabase/functions/bulk-create-walks/index.ts" "tests/lib/actions/admin-round-actions.test.ts"
  • npm test

Closes #96

@zzawook zzawook marked this pull request as ready for review May 22, 2026 11:10
@zzawook zzawook requested a review from Copilot May 22, 2026 11:10
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enforces a hard cap of 3 volunteers per walk slot across the admin create/update flows and bulk-create pipeline, aligning UI constraints, server-side validation, and the bulk-create edge function with the same 1..3 rule (per Issue #96).

Changes:

  • Tighten server-side validation in admin-round-actions to require maxVolunteers be an integer in [1, 3], and default to 3 when omitted.
  • Enforce the same 1..3 validation and defaulting in the bulk-create-walks Supabase edge function.
  • Update admin UI number inputs to cap max volunteers at 3 and adjust tests for the new validation/error message.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
tests/lib/actions/admin-round-actions.test.ts Updates/extends action tests to reflect the 1..3 max volunteers cap (including bulk-create validation).
supabase/functions/bulk-create-walks/index.ts Adds a shared cap constant and validates/normalizes slot capacity before inserting rows.
lib/actions/admin-round-actions.ts Enforces integer-only max volunteers validation and applies the 3-volunteer default via nullish coalescing.
app/(app)/admin/walks/walks-client.tsx Updates admin inputs to cap max volunteers at 3 (with follow-up UX concerns noted in comments).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +354 to 355
<input type="number" min="1" max={MAX_VOLUNTEERS_PER_SLOT} value={maxVol} onChange={e => setMaxVol(e.target.valueAsNumber)}
className="w-full px-4 py-3 border border-gray-300 rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-green-500" />
Comment on lines +580 to 581
<input type="number" min="1" max={MAX_VOLUNTEERS_PER_SLOT} value={bulkRule.maxVolunteers}
onChange={e => setBulkRule(r => ({ ...r, maxVolunteers: e.target.valueAsNumber }))}
Comment on lines 45 to 47
const DAY_LABELS = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
const MAX_VOLUNTEERS_PER_SLOT = 3

@zzawook zzawook changed the title [codex] Enforce three-volunteer slot cap Enforce three-volunteer slot cap May 25, 2026
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.12 Enforce a maximum of three volunteers per survey slot

2 participants