fix(admin): per-row check-in toggle; feat(db): front-desk gate + badge copies
Registrations table felt buggy because both row actions did setBusy(true) -> write -> reloadRegistrations() -> setBusy(false): the list is sorted by points, so a reload made the row you just touched jump (or vanish under a Checked-in filter), and the single `busy` flag disabled every control in the table for the whole request. The fix is per-row in-flight state (busyIds + withRowBusy) and no reload at all: the toggle patches its own row's checked_in plus the points delta the RPC returns, the type change patches `type`; a rejected write rolls both back. Only the touched row is disabled, shows a "Saving…" pulse, and two rows can save at once. Toggle hit area is now 40x41 px with a focus-visible ring. Front-desk gate: checkin_attendee reads registrations.checked_in and raises "This attendee needs to be checked in at the front desk first." when it is not true, and no longer sets checked_in as a side effect. checkins has no INSERT policy, so the RPC is the only write path and the gate cannot be bypassed. The scanner shows a dedicated "Not checked in yet" sheet instead of a toast. Badge copies: events.badge_copies (1..4, default 1). welcome_checkin sends that many pgmq jobs in one transaction (the Pi prints one label per job, so N jobs = N labels; no worker change) and clamps the value again itself. preview_welcome_checkin gained a `copies` column (drop + recreate) so the popup states the real count. Manual reprint still prints exactly one. Set from Settings -> Badge printing (active event) and the Events form, always as a single-column update; the Settings badge section now renders even when the LLM settings call fails. Tests: badge_print 113 (+6), leaderboard 47 (+1), new registration-checkin-toggle (6), front-desk-gate (3), welcome-badge-copies (3); the stale registrations-PATCH mock in registration-ticket-merge now targets set_registration_checked_in, the ambiguous Save button is "Save copies", and the print-copy assertion tolerates the typographic apostrophe. Docs updated (rpcs, schema, printing, tests, admin-app, screens) with a release record; NOT deployed - see docs/releases/2026-10-19.md. Co-authored-by: Stephan Charles <[email protected]> Co-authored-by: Amelia Hernandez <[email protected]> Co-authored-by: Markus Franz <[email protected]> Co-authored-by: Sabrina Hota <[email protected]> Co-authored-by: Nilüfer Doğan <[email protected]>
This commit is contained in:
1 parent
d3531e1fac
commit
17473916a6
27 files changed
+1378
-73
No files matched your search
@@ -19,11 +19,12 @@ values ('[email protected]', 'Player', false), ('[email protected]', 'Pe
|
||||
('[email protected]', 'Other', false), ('[email protected]', 'Speaker', false),
|
||||
('[email protected]', 'Staff', false), ('[email protected]', 'Admin', true),
|
||||
('[email protected]', 'Domain Admin', false), ('[email protected]', 'Orphan', false);
|
||||
insert into public.registrations (event_id, contact_email, type, qr_token, points)
|
||||
insert into public.registrations (event_id, contact_email, type, qr_token, points, checked_in)
|
||||
select 'a0150000-0000-0000-0000-000000000001'::uuid, email,
|
||||
case when email = '[email protected]' then 'staff'
|
||||
when email = '[email protected]' then 'speaker' else 'attendee' end::public.registration_type,
|
||||
'LB-' || email, case when is_admin or email = '[email protected]' then 99 else 0 end
|
||||
'LB-' || email, case when is_admin or email = '[email protected]' then 99 else 0 end,
|
||||
true
|
||||
from public.contacts where email in ('[email protected]', '[email protected]', '[email protected]',
|
||||
'[email protected]', '[email protected]', '[email protected]', '[email protected]');
|
||||
insert into public.registrations (event_id, contact_email, type, qr_token, points)
|
||||
@@ -36,6 +37,13 @@ values ('a0150000-0000-0000-0000-000000000011', 'a0150000-0000-0000-0000-0000000
|
||||
('a0150000-0000-0000-0000-000000000012', 'a0150000-0000-0000-0000-000000000001', -151001, 'Talk two'),
|
||||
('a0150000-0000-0000-0000-000000000013', 'a0150000-0000-0000-0000-000000000001', -151002, 'Service');
|
||||
|
||||
-- A front-desk-UNCHECKED attendee: has a registration but checked_in = false,
|
||||
-- so a session check-in must be blocked by the front-desk gate.
|
||||
insert into public.contacts (email, full_name, is_admin)
|
||||
values ('[email protected]', 'Fresh Face', false);
|
||||
insert into public.registrations (event_id, contact_email, type, qr_token, points, checked_in)
|
||||
values ('a0150000-0000-0000-0000-000000000001', '[email protected]', 'attendee', '[email protected]', 0, false);
|
||||
|
||||
do $$
|
||||
declare
|
||||
event_one uuid := 'a0150000-0000-0000-0000-000000000001';
|
||||
@@ -63,6 +71,17 @@ begin
|
||||
if sqlerrm <> 'service sessions cannot be checked in' then raise; end if;
|
||||
end;
|
||||
perform pg_temp.assert_board(true, 'service check-in rejected');
|
||||
-- Front-desk gate: an attendee not checked in at the event cannot be scanned
|
||||
-- into a session; the RPC raises a clear message.
|
||||
begin
|
||||
perform public.checkin_attendee(talk_one, '[email protected]');
|
||||
raise exception 'front-desk gate allowed a session check-in';
|
||||
exception when raise_exception then
|
||||
if sqlerrm not like '%front desk%' then raise; end if;
|
||||
end;
|
||||
perform pg_temp.assert_board(
|
||||
(select not exists (select 1 from public.checkins where contact_email = '[email protected]')),
|
||||
'front-desk gate blocks session check-in');
|
||||
foreach excluded_email in array array['[email protected]','[email protected]','[email protected]'] loop
|
||||
perform set_config('request.jwt.claims', json_build_object('email', excluded_email)::text, true);
|
||||
select * into feedback_result from public.submit_feedback(talk_one, 5, 'Review');
|
||||
|
||||
Reference in new issue
Block a user