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). 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
e243b83a56
commit
3ee91b5ad6
22 files changed
+809
-166
No files matched your search
@@ -0,0 +1,87 @@
|
||||
# Staff Auto-Connect, Points Hygiene, Leaderboard Privacy (2026-10-20)
|
||||
|
||||
Three user-requested changes, one migration:
|
||||
`20261020120000_staff_auto_connections.sql` (applied to the local stack,
|
||||
**pending production**).
|
||||
|
||||
## 1. Staff are automatically connected to everyone — never for points
|
||||
|
||||
Every staff member now appears in every other participant's "My connections"
|
||||
list for the same event, from the moment either registration exists — no
|
||||
request, no accept step. **Connecting with staff never grants points** (the
|
||||
explicit requirement): the rows are inserted directly as `accepted` and never
|
||||
pass through `accept_connection`/`_award_points`.
|
||||
|
||||
- "Staff" is exactly the points-exempt set (`_points_eligible`): registration
|
||||
type `staff`, Admin contact, or an `@appe.at` address. Everyone else is a
|
||||
"person". Only staff × person pairs are created — never staff × staff,
|
||||
never person × person.
|
||||
- Trigger `registrations_autoconnect_staff` fires on registration INSERT and
|
||||
on type changes (both directions: a late attendee pairs with existing staff,
|
||||
a newly registered staff member pairs with everyone). `_autoconnect_staff_event(event)`
|
||||
is the idempotent full pass, run once per event as the backfill.
|
||||
- The unique pair index makes every pass conflict-free: an existing pair —
|
||||
including a manually **rejected** one — is never touched.
|
||||
- New column `connections.auto` (default `false`) marks these rows. Attendees
|
||||
see them normally; the admin console (Dashboard activity feed, Activity
|
||||
connections table) filters them out so counts stay honest.
|
||||
- Scanning a staff lanyard is already-connected behaviour: `create_connection_request`
|
||||
returns the existing `accepted` row and the app toasts "You're connected!".
|
||||
|
||||
## Points logic, as reviewed on 2026-10-20
|
||||
|
||||
Every award goes through `_award_points(event, email, delta, category)`, which
|
||||
clamps at 0 (`greatest(0, points + delta)`), logs to `points_log`, and no-ops
|
||||
without a registration unless `_points_eligible` holds — i.e. there is a
|
||||
registration in **that** event with type ≠ `staff`, the contact is **not**
|
||||
`is_admin`, and the email is **not** on `@appe.at`.
|
||||
|
||||
| Event | Who earns | Δ | category | Where |
|
||||
|---|---|---|---|---|
|
||||
| Welcome (front-desk) check-in | attendee | **+10** | `checkin` | `welcome_checkin` / `set_registration_checked_in` (un-toggling removes exactly what it added, as `admin`) |
|
||||
| Session check-in | attendee | **+10** | `checkin` | `checkin_attendee` (once per session; service sessions excluded) |
|
||||
| Connection accepted | both people | **+5 each** | `connection` | `accept_connection` |
|
||||
| Talk networking bonus | both people | **+`events.talk_networking_bonus` each** | `talk_networking` | `accept_connection`, only if both attended the same session |
|
||||
| Session feedback | attendee | **+5** rating only, **+10** rating + comment | `feedback` | `submit_feedback` (first submission only) |
|
||||
| **Event feedback** | attendee | **+5** | `feedback` | `submit_event_feedback` — first submission only, added by `20261020130000_event_feedback_points.sql` |
|
||||
| Admin adjustment | any eligible attendee | **±n** | `admin` | `adjust_points` (admin-only; **always the active event**) |
|
||||
| **Staff connection (auto)** | **nobody** | **0** | — | trigger insert, never `accept_connection` |
|
||||
|
||||
## 2. Admin console: points belong to the pass, not the contact
|
||||
|
||||
- **Contacts**: the Points button + modal **removed** — a contact without a
|
||||
pass cannot earn anything, so editing points there could silently do nothing.
|
||||
- **Registrations**: eligible rows of the **active** event get a **Points**
|
||||
button → the adjustment modal. On non-active events the button is disabled
|
||||
with a tooltip because `adjust_points` always targets the active event's
|
||||
pass. The save patches the row in place (no reload, no reorder) and the
|
||||
silent refresher settles the truth — the same self-healing pattern as the
|
||||
check-in toggle.
|
||||
- **Dashboard "Top points"**: email addresses removed — name only.
|
||||
- Dashboard feed + Activity hide `auto` connections.
|
||||
|
||||
## 3. Leaderboard names are masked
|
||||
|
||||
`Leaderboard.tsx` now renders **first name + last-name initial + dot**
|
||||
("Max Muster" → "Max M.") on the podium *and* in the ranked rows (the podium
|
||||
previously showed the bare first name; rows leaked the full surname). The
|
||||
`(you)` marker still matches on the email, which never leaves the client.
|
||||
|
||||
## Verification
|
||||
|
||||
- `supabase/tests/staff_auto_connections_tests.sql` — **14 assertions green**
|
||||
(pair creation both directions, staff×staff/people×people never paired,
|
||||
**zero points_log rows and unchanged points**, late arrivals, rejected-pair
|
||||
protection, idempotent re-run, type flip, helper revokes).
|
||||
- Live local stack after the backfill: 678 auto rows, 6 staff in the active
|
||||
event, **0 new `points_log` rows**.
|
||||
- `npm run build` green for both apps.
|
||||
- e2e: `leaderboard-live.spec.ts` now asserts the masked names (and that full
|
||||
names do **not** appear). `connections.spec.ts` **CONV-CONN-007 rewritten** —
|
||||
its old premise (manual staff networking, staff declining a request) is
|
||||
obsolete by design: the feature pre-accepts those pairs. The rewrite asserts
|
||||
pre-connected lists both ways, the instant-connect toast, `status|auto =
|
||||
accepted|true` in the DB, and unchanged points for both parties. Like the
|
||||
rest of that file it still rides the known seed drift (see
|
||||
[../backend/tests.md](../backend/tests.md)); the backend guarantee is what
|
||||
the SQL suite covers. Runbook: [../backend/tests.md](../backend/tests.md).
|
||||
@@ -10,6 +10,7 @@ appended, so the record shows what was believed and when it was fixed.
|
||||
|
||||
| Date | Contents |
|
||||
|---|---|
|
||||
| [2026-10-20](./2026-10-20.md) | Staff auto-connected to everyone (never for points, `connections.auto`), points adjustment moved Contacts → Registrations with active-event guard, Dashboard top-points without emails, leaderboard names masked, event feedback pays +5 (session feedback confirmed +5/+10) — local stack applied, **production pending** |
|
||||
| [2026-10-19](./2026-10-19.md) | Welcome-check-in confirmation + camera fixes; per-row check-in toggle, front-desk gate, badge copies — **deployed**; then points correctness (welcome +10, toggle restore, visible exclusions), Sessions view, AI connection test, silent refresh, tooltip containment, speaker pending-material deep link — **deployed**, incl. the corrected test numbers and the seed-drift diagnosis |
|
||||
| [2026-10-18](./2026-10-18.md) | Badge print queue on the Pi stations |
|
||||
| [2026-10-17](./2026-10-17.md) | Reports + event feedback work |
|
||||
|
||||
Reference in new issue
Block a user