feat: sync GridSmart agendas and use event-relative demo time

Support script and URL sources, automatic Sessionize polling, staff-linked service sessions, chronological agenda blocks, and inline Placeholders. Fix demo mode to use the active event date and document deployed behavior with regression coverage.

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:
committed 2026-10-11 08:39:15 +02:00
1 parent f32289f583
commit 84691de6ee
27 files changed
+1215 -60

No files matched your search

@@ -0,0 +1,60 @@
create or replace function public._assign_service_session_speakers(p_session_id uuid, p_event_id uuid)
returns integer
language plpgsql security definer set search_path = '' as $$
declare
affected integer;
begin
insert into public.session_speakers (session_id, contact_email)
select se.id, r.contact_email
from public.sessions se
join public.slots slot on slot.id = se.slot_id and slot.event_id = se.event_id
join public.registrations r on r.event_id = se.event_id and r.type = 'staff'
where se.id = p_session_id and se.event_id = p_event_id
and slot.type = 'service_session'
on conflict (session_id, contact_email) do nothing;
get diagnostics affected = row_count;
return affected;
end;
$$;
create or replace function public._trg_service_session_staff()
returns trigger
language plpgsql security definer set search_path = '' as $$
begin
perform public._assign_service_session_speakers(new.id, new.event_id);
return new;
end;
$$;
create trigger trg_service_session_staff
after insert or update of slot_id, event_id on public.sessions
for each row execute function public._trg_service_session_staff();
create or replace function public._trg_staff_service_sessions()
returns trigger
language plpgsql security definer set search_path = '' as $$
begin
if new.type = 'staff' then
insert into public.session_speakers (session_id, contact_email)
select se.id, new.contact_email
from public.sessions se
join public.slots slot on slot.id = se.slot_id and slot.event_id = se.event_id
where se.event_id = new.event_id and slot.type = 'service_session'
on conflict (session_id, contact_email) do nothing;
end if;
return new;
end;
$$;
create trigger trg_staff_service_sessions
after insert or update of type, event_id, contact_email on public.registrations
for each row execute function public._trg_staff_service_sessions();
revoke all on function public._assign_service_session_speakers(uuid, uuid) from public, anon, authenticated;
revoke all on function public._trg_service_session_staff() from public, anon, authenticated;
revoke all on function public._trg_staff_service_sessions() from public, anon, authenticated;
select public._assign_service_session_speakers(se.id, se.event_id)
from public.sessions se
join public.slots slot on slot.id = se.slot_id and slot.event_id = se.event_id
where slot.type = 'service_session';
@@ -0,0 +1,30 @@
do $$
declare
definition text;
original text;
lookup text := 'and start_time = v_start and end_time = v_end';
marker text := '-- Find or create the slot by (event, date, start, end).';
begin
select pg_get_functiondef('public.sync_sessionize_event(uuid,jsonb)'::regprocedure) into original;
if length(original) - length(replace(original, lookup, '')) <> length(lookup)
or position(marker in original) = 0 then
raise exception 'Unexpected Sessionize sync definition; refusing unsafe replacement';
end if;
definition := replace(original, lookup, lookup || E'\n and type = case when v_service then ''service_session''::public.slot_type else ''session''::public.slot_type end');
definition := replace(definition, marker, $replacement$
if v_service and not exists (select 1 from public.sessions where external_id = v_ext) then
update public.sessions se set external_id = v_ext
from public.slots sl
where se.slot_id = sl.id and se.event_id = p_event_id
and se.external_id like 'manual-service-%'
and se.title = v_title and sl.type = 'service_session'
and sl.slot_date = v_date and sl.start_time = v_start and sl.end_time = v_end
and (select count(*) from public.sessions candidate join public.slots candidate_slot on candidate_slot.id = candidate.slot_id
where candidate.event_id = p_event_id and candidate.external_id like 'manual-service-%'
and candidate.title = v_title and candidate_slot.type = 'service_session'
and candidate_slot.slot_date = v_date and candidate_slot.start_time = v_start and candidate_slot.end_time = v_end) = 1;
end if;
$replacement$ || marker);
execute definition;
end;
$$;