feat(points): staff auto-connect never scores; event feedback pays +5

- Migration 20261020120000: staff (type staff / Admin / @appe.at) are
  auto-connected to every participant of the event via connections.auto
  rows inserted directly as accepted - never through accept_connection,
  so zero points by construction; backfill + idempotent helper + trigger.
- Migration 20261020130000: submit_event_feedback awards +5 on the first
  submission per participant x event (edits earn 0), gated by
  _points_eligible; response gains earned column; ACL restored.
- Admin: points move from Contacts to Registrations (active-event rows
  only, in-place save); Dashboard Top points drops emails; Dashboard and
  Activity hide auto connections.
- Attendee: leaderboard masks surnames (Max M.); EventFeedback toast
  shows +5 pts on paid submissions.
- Tests: staff_auto_connections_tests.sql (14 assertions), rpc_tests
  section 11 (4 assertions). Docs + release record 2026-10-20.
- README: document the git-ignored .env provisioning step (missing key
  = white screen).
This commit is contained in:
lago committed 2026-10-20 22:15:29 +02:00
1 parent b7c2abb73b
commit 35b88d50ca
22 files changed
+809 -166

No files matched your search

+21
View File
@@ -213,6 +213,15 @@ for the slot before inserting).
| `status` | `text` | `pending` \| `accepted` \| `rejected` (default `pending`) |
| `created_at` | `timestamptz` | |
| `resolved_at` | `timestamptz` | set when accepted/rejected |
| `auto` | `boolean` | staff auto-pairing (never hand-made, never scored) — `20261020120000_staff_auto_connections.sql` |
**Staff auto-connect:** the trigger `registrations_autoconnect_staff` inserts a
staff × person pair as `accepted`, `auto = true` whenever a registration is
created or changes type (plus a backfill in the migration). Staff here means
exactly the points-exempt set (`_points_eligible`): type `staff`, Admin contact,
or an `@appe.at` address. No points are ever awarded for these rows, and
existing pairs — including manually rejected ones — are never touched. The admin
console hides `auto` rows from its activity views.
**Constraint:** unique per **unordered pair per event** via
`unique index connections_pair_uniq on (event_id, least(from_email, to_email),
@@ -248,6 +257,18 @@ contact per session (prevents double points).
**Constraint:** `unique (event_id, contact_email, session_id)` — one feedback per
contact per session.
Points (awarded by `submit_feedback`, first submission only): **+5** rating
only, **+10** rating + non-empty comment.
## `event_feedback` — event-level rating
Same shape as `feedback` but `session_id` is replaced by
`unique (event_id, contact_email)` — one answer per participant per event,
upserted by `submit_event_feedback` (read by `get_my_event_feedback`).
Points: **+5** on the **first** submission only (edits earn nothing), gated by
`_points_eligible` — see `20261020130000_event_feedback_points.sql`.
## `leaderboard` — Realtime mirror
A public, Realtime-friendly mirror of points **per event**. **Not** the source of