Post-event reporting + talk networking incentives

- Talk networking: per-event talk_networking_bonus awarded when two people
  who shared a checked-in talk accept a connection (accept_connection
  re-created, shared_talk flag, get_talk_cohort RPC, points_log category
  check widened); Convivo Networking sub-tab inside the Connect screen
  (Home quick action deep-links in; Connect button reflects existing
  connection state and is disabled for sent/connected/declined); admin
  Events view bonus input (0-10).
- Reports: sidecar POST /export (CSV / multi-sheet XLSX / PDF report via
  new pdfkit dep); APPE Admin Reports view (any event: on-screen summary,
  session feedback summary, top-5, CSV/Excel/PDF downloads); Activity
  session-feedback per-session aggregate header.
- Also carried: @appe.at admin trigger + default password, bulk contact
  delete, session level/area + event-level feedback, agenda level/area
  filters, admin password self-service, schedule level/area fields.
- 18/18 RPC tests; both apps build; exports verified end-to-end.
This commit is contained in:
Lago committed 2026-09-21 22:34:25 +02:00
1 parent 08ab41898b
commit 3adc0fd58f
35 files changed
+3973 -54

No files matched your search

+7
View File
@@ -140,6 +140,13 @@ the work atomically, and the `leaderboard` table change fans out over Realtime.
Supabase Table Editor makes it work with `signInWithPassword` immediately.
(Staff can also still log in with their email + QR token, their seeded Auth
password.)
- **`@appe.at` admins:** any contact on the `@appe.at` domain is an admin
(`is_admin()` is domain-aware) and logs in with the **default admin password
`appe-admin-2026`** out of the box. The `trg_contacts_appe_at_admin` trigger
sets `contacts.password` to the default (when null) and the auth-user
creation helpers hash it into `auth.users.encrypted_password`, so a
freshly-created `@appe.at` admin can sign in immediately. A custom password
set on the contact row is always respected.
- `enable_confirmations = false`, so **no email is sent** — the email is only a
"confirm it's you" check against the ticket purchase.
- After login, the app holds a **session JWT** (in `localStorage`) that lasts
+16 -1
View File
@@ -27,6 +27,7 @@ Source of truth:
|---|---|---|
| Checked into a session (by staff) | **+10** | the attendee |
| Connection accepted | **+5 each** | both people |
| Connection accepted **with a shared talk** | **+`talk_networking_bonus` each** (per event, default 2, `0` = off) | both people (category `talk_networking`) |
| Feedback — rating only | **+5** | the attendee |
| Feedback — rating + comment | **+10** | the attendee |
| Admin adjustment | any | the target (audited as `admin`) |
@@ -62,6 +63,7 @@ triggers and the feedback RPC.
| `get_public_contacts()` | `email, full_name, linkedin_url`, `show_email`, `registration_type` (active-event registrants) | Connections name/type lookups |
| `get_agenda()` | flat rows: slot fields + session fields + `speakers` (string_agg) | Agenda + Home |
| `get_active_event()` | the active `events` row (or none) | event name/dates/location |
| `get_talk_cohort(p_session_id)` | `email, full_name, registration_type, qr_token` of the **other** attendees checked into that session (staff excluded, self excluded) | the Networking screen's "also attended" list |
All are `security definer` and expose **only public columns** (email is included
because `contacts` is keyed by email and is the identity; `qr_token` is never
@@ -84,12 +86,25 @@ Creates a **pending** connection to the contact whose QR was scanned.
- **Idempotent:** if the pair already has a connection (either direction) for the
active event, returns the existing one instead of creating a duplicate.
### `accept_connection(p_connection_id)` → `connections`
### `accept_connection(p_connection_id)` → `(event_id, from_email, to_email, status, created_at, resolved_at, shared_talk)`
Accepts an **incoming** request.
- Locks the row (`for update`), verifies the caller is the recipient
(`to_email = current_email()`) and the status is still `pending`.
- Sets `status = 'accepted'`, `resolved_at = now()`.
- **Awards +5 to both** `from_email` and `to_email` (category `connection`).
- **Talk networking bonus:** computes whether the two parties share a
checked-in session (talk) — i.e. there is a session both were checked into
(`checkins` intersection). If they do **and** the event's
`talk_networking_bonus > 0`, it awards that bonus to **each** party
(category `talk_networking`). Returns `shared_talk = true` in that case so
the app can show a "met at {talk}" note.
- **Idempotency:** the function is one-shot (row locked, status must be
`pending`), so the bonus can never double-award.
- **Documented limitation:** check-ins that happen **after** acceptance do
not retro-award the bonus — it reflects shared attendance at acceptance
time.
- The bonus flows through `_award_points`, so the leaderboard sync + staff
exclusion are inherited automatically.
### `reject_connection(p_connection_id)` → `connections`
Same guards as accept, but sets `status = 'rejected'`. No points.
+2 -1
View File
@@ -79,6 +79,7 @@ queries everything for the active event and handles "no active event" gracefully
| `num_checked_in_registrations` | `integer` | maintained aggregate |
| `sessionize_endpoint` | `text` | nullable — the Sessionize API URL for this event (see [sidecar.md](./sidecar.md)) |
| `use_realtime_clock` | `boolean` | default `false` — when `true`, the attendee app drives slot status (Live/Next/Done) from the real system clock; when `false` it uses the simulated mid-event clock (see [../frontend/app-structure.md](../frontend/app-structure.md)) |
| `talk_networking_bonus` | `integer` | default `2` — bonus points awarded to **each** party when two people who were checked into the same session (talk) accept a connection. `0` disables the feature (the +5 connection award still applies). Awarded with the `talk_networking` points category (see [rpcs.md](./rpcs.md#accept_connectionp_connection_id-uuid)) |
| `last_synced_at` | `timestamptz` | nullable — when the Sessionize sync last ran |
| `created_at` | `timestamptz` | |
@@ -277,7 +278,7 @@ Powers the per-category points breakdown on the Profile screen (per event).
| `event_id` | `uuid` FK → `events` | `on delete cascade` |
| `contact_email` | `text` FK → `contacts` | |
| `delta` | `integer` | points added (can be negative for admin adjustments) |
| `category` | `text` | `checkin` \| `connection` \| `feedback` \| `admin` |
| `category` | `text` | `checkin` \| `connection` \| `feedback` \| `admin` \| `talk_networking` (CHECK constraint, widened by the talk-networking migration) |
| `created_at` | `timestamptz` | |
Index: `points_log_event_id_idx (event_id)`.
+9
View File
@@ -70,6 +70,15 @@ staff share the password **`appe-admin-2026`** (stored in `contacts.password`,
auto-synced to `auth.users.encrypted_password` by the `trg_contact_password_sync`
trigger).
> **Default admin password:** any `@appe.at` contact is an admin and logs in
> with **`appe-admin-2026`** out of the box. The `trg_contacts_appe_at_admin`
> trigger sets `contacts.password = 'appe-admin-2026'` (when null) on
> insert/update, and the auth-user-creation helpers hash it into
> `auth.users.encrypted_password` so a freshly-created `@appe.at` admin can log
> in immediately. A custom password set on the contact row is always respected
> (never overwritten). See migration
> [`20260910000000_admin_default_password.sql`](../../supabase/migrations/20260910000000_admin_default_password.sql).
| Person | Type | Email | Login |
|---|---|---|---|
| **Amelia Hernandez** | staff (admin) | amelia@appe.at | `appe-admin-2026` |
+23 -2
View File
@@ -8,8 +8,9 @@ APPE Admin **Interfaces** menu — it runs **on demand only** (no scheduling).
- Code: [`apps/sidecar/`](../../apps/sidecar/) (single file:
[`src/server.js`](../../apps/sidecar/src/server.js))
- Image: [`apps/sidecar/Dockerfile`](../../apps/sidecar/Dockerfile)
(`node:20-alpine`; one runtime dependency, **`xlsx`**, to parse the Sessionize
Excel export — everything else is built-in `http` + `fetch`)
(`node:20-alpine`; runtime dependencies **`xlsx`** (parse the Sessionize Excel
export) and **`pdfkit`** (render the PDF report) — everything else is built-in
`http` + `fetch`)
- Compose service: `convivo-sidecar` in the root
[`docker-compose.yml`](../../docker-compose.yml) (`:3002`)
- DB side: the `sync_sessionize_event` RPC + `sync_runs` audit table — see
@@ -82,6 +83,7 @@ flowchart LR
| `GET` | `/status` | — | `{ ok, running, lastRun }` |
| `POST` | `/run` | `{ event_id }` | **blocking** — the API-sync result (summary + errors) |
| `POST` | `/import-excel` | `multipart/form-data` (`event_id` + `file` = the `.xlsx`) | **blocking** — the Excel-import result (summary + errors) |
| `POST` | `/export` | `{ event_id, format: 'csv' \| 'xlsx' \| 'pdf', tables? }` | **blocking** — `{ filename, mime, content_base64 }` (the event report) |
`/run` is **blocking**: it reads the event's endpoint, fetches Sessionize,
transforms, calls the RPC, and returns the summary. The admin's "Sync" button and
@@ -92,6 +94,21 @@ the Interfaces "Run sync" both call it and show the result inline.
calls that RPC. The admin's Interfaces **"Import Excel"** control posts the file
here and shows the result inline.
`/export` is **blocking** as well: it fetches the event's full dataset
(registrations, check-ins, connections, session feedback, event feedback,
leaderboard, points log — service role, joined for readability) and renders it as
one of three formats:
- **`csv`** — a single combined CSV (a `table` column distinguishes the rows).
- **`xlsx`** — one workbook, one sheet per table (the `tables` array selects
which sheets to include; defaults to all).
- **`pdf`** — a structured post-event report (header, summary, per-session
feedback, top-10 points, event-level feedback comments) rendered with `pdfkit`.
It returns `{ filename, mime, content_base64 }`; the admin's **Reports** view
decodes the base64 and triggers a browser download. Empty tables produce a valid
file with headers only (never an error); an unknown event is a 404.
## Env vars
| Var | Default | Notes |
@@ -134,3 +151,7 @@ The admin app reaches the sidecar through the same-origin `/sidecar/` proxy
creates the speaker contacts, links them to sessions, and creates/updates their
`speaker` registrations (idempotent on re-run). Verified: 21 speakers created,
25 speaker links, 21 speaker registrations, 0 errors.
- `POST /export` for each format against the seeded event → returns a parseable
file: CSV with a `table` column, XLSX with one sheet per table, and a valid
PDF report (verified: CSV ~10 KB, XLSX 7 sheets, PDF `%PDF-1.3`). Unknown
event → 404.
+21 -2
View File
@@ -63,8 +63,9 @@ apps/admin/src/
├─ Sponsors.tsx # sponsor CRUD
├─ Schedule.tsx # slots + sessions + speakers + material + AI-evaluate
├─ Activity.tsx # check-ins / connections / feedback tables
├─ Events.tsx # event management (+ sessionize_endpoint + per-row Sync)
└─ Interfaces.tsx # sidecar status / run / recent runs
├─ Events.tsx # event management (+ sessionize_endpoint + per-row Sync + talk networking bonus)
├─ Interfaces.tsx # sidecar status / run / recent runs
└─ Reports.tsx # post-event summary + CSV / Excel / PDF export (sidecar /export)
```
## Data access
@@ -117,6 +118,24 @@ The Schedule view uploads a session's material to the `materials` bucket and set
`sessions.material_path` (admins can write `sessions` directly). The **Evaluate**
button calls `evaluate_session_feedback` (the AI stub) to set
`ai_generated_feedback`.
### Reports (post-event summary + export)
The **Reports** view is the post-event reporting surface. It works for **any**
event (active or past) — the event selector defaults to the active event but can
pick a past one.
- **On-screen summary** — computed client-side from the same reads the export
uses: registrations (by type), check-ins, connections (total / accepted),
session feedback (count + average), event feedback (count + average), points by
category, and a top-5 leaderboard.
- **Session feedback summary** — a per-session table (title, room, average
rating, response count) sorted by average; this is the post-event session
feedback summary.
- **Export** — three buttons call the sidecar's [`POST /export`](../backend/sidecar.md#http-api):
**Download CSV**, **Download Excel**, **Download PDF report**. CSV/XLSX include
the tables ticked in the checkbox list (default: all); the PDF always uses the
full dataset. The response's base64 body is decoded and downloaded in the
browser (`downloadReport` in `lib/api.ts`).
## Styling
+32 -4
View File
@@ -12,10 +12,11 @@ from `useAuth()` (`contact` + `registration`).
| Home | `Home.tsx` | tab (default) |
| Agenda | `Agenda.tsx` | tab |
| Scan | `Scan.tsx` | tab (staff get an Attendee/Staff mode toggle inside) |
| Connections | `Connections.tsx` | tab |
| Connections | `Connections.tsx` | tab (hosts a **Networking** sub-tab; Home's "Networking" quick action deep-links into it) |
| Profile | `Profile.tsx` | tab |
| Leaderboard | `Leaderboard.tsx` | from Home (points pill / quick action) |
| Feedback | `Feedback.tsx` | full-screen takeover from Agenda |
| EventFeedback | `EventFeedback.tsx` | full-screen takeover from Home ("Rate this event") |
## Login
@@ -156,7 +157,8 @@ Data: `useEvent()` (for the session list) + the RPCs above.
## Connections
Two tabs: **My connections** and **Requests** (with a count badge).
Three sub-tabs: **My connections**, **Requests** (with a count badge), and
**🗣 Networking** (see [Networking](#networking-a-sub-tab-of-connections)).
- **My connections** — accepted connections (the other person's name +
registration type). **Clicking a row** opens a bottom **sheet** with that
@@ -167,8 +169,9 @@ Two tabs: **My connections** and **Requests** (with a count badge).
buttons (`acceptConnection` / `rejectConnection`), and outgoing (`from_email =
me`, pending) shown as "Sent". The person block is also clickable (same detail
sheet).
- Accepting awards +5 to both (see
[../backend/rpcs.md#accept_connectionp_connection_id--connections](../backend/rpcs.md#accept_connectionp_connection_id--connections)).
- Accepting awards +5 to both, **plus the per-event talk networking bonus** when
the two parties shared a checked-in talk (see
[../backend/rpcs.md#accept_connectionp_connection_id](../backend/rpcs.md#accept_connectionp_connection_id)).
- **Red dot** — any interaction with the connection logic (accept / decline / send)
dispatches a `connections-changed` window event; the Shell listens and
**recalculates the Connect red dot immediately** (it stays while any incoming
@@ -178,6 +181,31 @@ Two tabs: **My connections** and **Requests** (with a count badge).
Data: `getMyConnections()` + `getPublicContacts()` (names + types) +
`getLeaderboard()` (points for the detail sheet).
## Networking (a sub-tab of Connections)
A **sub-tab inside the Connect screen** (the third of My connections / Requests /
🗣 Networking; the screen header switches to "Networking" while it is active)
that rewards **networking around talks**. The Home "Networking" quick action
deep-links straight into it. Rendered by the `NetworkingPanel` component
(`Networking.tsx`). For every talk the user was checked into, it lists the
**other attendees who were also in that talk** (the "talk cohort") so the user
can make a connection.
- **Your talks** — the sessions the user is checked into (`getMyCheckins()`),
shown as cards (title, room, speakers).
- **Also attended** — for each talk, the other checked-in participants
(`get_talk_cohort(sessionId)` — staff excluded, self excluded), each with a
name + registration-type badge and a **Connect** button (the same
`createConnectionRequest` flow as the Scan screen).
- **Bonus** — when the event's `talk_networking_bonus > 0`, the header shows
"Connect with them to earn +N pts (shared talk)". Accepting a connection with
a shared talk awards the bonus (see
[../backend/rpcs.md#accept_connectionp_connection_id](../backend/rpcs.md#accept_connectionp_connection_id)).
- **Empty states** — "You haven't been checked into a talk yet…" (no check-ins)
and "No one else was checked in here yet." (a talk with no other attendees).
Data: `getMyCheckins()` + `getTalkCohort()` + the agenda (via `useEvent()`).
## Feedback
A **full-screen takeover** (no tab bar), opened from the Agenda session sheet.
+50 -2
View File
@@ -44,9 +44,18 @@ current phase.
> **Real-time clock toggle** (a per-event `events.use_realtime_clock` flag,
> toggled in the admin Events view, switches the attendee app between the real
> system clock and the simulated mid-event clock for Live/Next/Done status; the
> Home header shows a 🎬 Demo clock badge only in simulated mode).
> Home header shows a 🎬 Demo clock badge only in simulated mode), and
> **Post-event reporting + talk networking incentives** (a per-event
> `talk_networking_bonus` awarded when two people who shared a checked-in talk
> accept a connection, a Convivo **Networking** sub-tab inside the Connect
> screen that lists the "also attended" cohort per talk (the Home "Networking"
> quick action deep-links into it), a new APPE Admin **Reports** view with an
> on-screen post-event summary + session-feedback summary and CSV / Excel / PDF
> export served by a new sidecar `POST /export` endpoint, and a per-session
> aggregate header in the Activity session-feedback tab).
> Remaining work is cross-cutting (deployment, testing, and the ticket/Pretix
> sync that will consume the speaker links by email).
> sync that will consume the speaker links by email). **Badge printing was
> evaluated and skipped by decision** (no printing feature was built).
## Done
@@ -494,6 +503,45 @@ drives slot status (Live/Next/Done) from the **real system clock** or the
slot.
- **Migration:** [`20260834000000_event_realtime_clock.sql`](../../supabase/migrations/20260834000000_event_realtime_clock.sql).
## Post-event reporting + talk networking incentives — ✅ complete
A round (migration `20260920000000_talk_networking.sql` + app + sidecar changes),
verified end-to-end (18/18 RPC tests, all three export formats). **Badge
printing was evaluated and skipped by decision** — no printing feature was built.
**Talk networking incentives.**
- `events.talk_networking_bonus` (integer, default `2`; `0` disables) — the
bonus each party earns when two people who were checked into the **same
session (talk)** accept a connection. Awarded with the new `talk_networking`
points category (the `points_log.category` CHECK was widened to include it).
- `accept_connection` was re-created to compute the shared-check-in overlap and
award the bonus (through `_award_points`, so the leaderboard sync + staff
exclusion are inherited), and to return a `shared_talk` flag. One-shot, so it
can never double-award; check-ins after acceptance don't retro-award.
- `get_talk_cohort(p_session_id)` — the other attendees (staff excluded, self
excluded) checked into a session, for the Networking screen.
- **Convivo app:** a **Networking** sub-tab inside the Connect screen (the
Home "Networking" quick action deep-links into it) lists, per talk the user
is checked into, the "also attended" cohort with a Connect button; the
Profile points breakdown shows the `Talk networking` category.
- **APPE Admin:** a **Talk networking bonus** input (0–10) in the Events
create/edit modal.
**Post-event reporting / export.**
- **Sidecar `POST /export`** (`{ event_id, format: csv|xlsx|pdf, tables? }`)
fetches the event's full dataset (service role) and renders it: a combined
**CSV** (a `table` column), a multi-sheet **XLSX** (one sheet per table), or
a structured **PDF** post-event report (new `pdfkit` dependency). Returns
`{ filename, mime, content_base64 }`; unknown event → 404, empty tables → a
valid file with headers only.
- **APPE Admin Reports view** — works for **any** event (active or past): an
on-screen summary (registrations by type, check-ins, connections, session +
event feedback averages, points by category, top-5 leaderboard), a **session
feedback summary** table (per-session average + response count), and CSV /
Excel / PDF download buttons (base64 → browser download).
- **Activity → Session feedback** gains a compact **per-session aggregate
header** (average + count per session).
## Cross-cutting / later
- **Subdomains** — `convivo.appe.at`, `admin.appe.at`, `db.appe.at` don't exist