feat: drop attendance marks and bullet volunteer names with the sunburst

Coordinators no longer record who came. Public roster names use the sunburst as a bullet.
This commit is contained in:
blake committed 2026-10-26 16:10:49 -05:00
1 parent 1a8959c86a
commit df3165f6a8
15 files changed
+68 -247

No files matched your search

+5 -72
View File
@@ -455,69 +455,6 @@ describe('coordinator screens', () => {
expect(count(db, "SELECT COUNT(*) AS n FROM signups WHERE email_norm = 'late@example.invalid'")).toBe(0);
});
it('marks attendance without emailing or showing it publicly', async () => {
const { app, db } = await buildApp();
const cookie = await signIn(app, db);
const shiftId = await openShift(app, cookie, { published: true, capacity: '2', role: 'Greeting', date: '2026-10-22' });
const added = await postWalkIn(app, cookie, shiftId, { name: 'Ria Example', email: 'ria.fake@example.invalid' });
expect(added.status).toBe(303);
const signupId = (db.prepare("SELECT id AS id FROM signups WHERE email_norm = 'ria.fake@example.invalid'").get() as { id: number }).id;
const mailBefore = count(db, 'SELECT COUNT(*) AS n FROM outbox');
const attended = await postForm(app, `/admin/signups/${signupId}/attendance`, cookie, { mark: 'attended' });
expect(attended.status).toBe(303);
expect(attended.headers.get('location')).toContain('notice=attended');
expect(db.prepare('SELECT attended AS attended FROM signups WHERE id = ?').get(signupId)).toEqual({ attended: 1 });
expect(count(db, 'SELECT COUNT(*) AS n FROM outbox')).toBe(mailBefore);
expect(count(db, "SELECT COUNT(*) AS n FROM audit WHERE action = 'signup.attend'")).toBe(1);
const repeat = await postForm(app, `/admin/signups/${signupId}/attendance`, cookie, { mark: 'attended' });
expect(repeat.status).toBe(303);
expect(count(db, "SELECT COUNT(*) AS n FROM audit WHERE action = 'signup.attend'")).toBe(1);
const roster = await (await app.request(attended.headers.get('location') ?? '', { headers: { cookie } })).text();
expect(roster).toContain('Marked attended.');
expect(roster).toContain('Attended.');
expect(roster).toContain('aria-pressed="true"');
const missed = await postForm(app, `/admin/signups/${signupId}/attendance`, cookie, { mark: 'no-show' });
expect(missed.status).toBe(303);
expect(db.prepare('SELECT attended AS attended FROM signups WHERE id = ?').get(signupId)).toEqual({ attended: 0 });
const missedPage = await (await app.request(missed.headers.get('location') ?? '', { headers: { cookie } })).text();
expect(missedPage).toContain('No-show.');
const cleared = await postForm(app, `/admin/signups/${signupId}/attendance`, cookie, { mark: 'clear' });
expect(cleared.status).toBe(303);
expect(db.prepare('SELECT attended AS attended FROM signups WHERE id = ?').get(signupId)).toEqual({ attended: null });
expect(count(db, "SELECT COUNT(*) AS n FROM audit WHERE action = 'signup.attend.clear'")).toBe(1);
const marked = await postForm(app, `/admin/signups/${signupId}/attendance`, cookie, { mark: 'attended' });
expect(marked.status).toBe(303);
const publicShift = await (await app.request(`/s/${shiftId}`)).text();
expect(publicShift).not.toContain('ria.fake@example.invalid');
expect(publicShift).not.toContain('No-show');
expect(publicShift).not.toContain('Attended.');
expect(await (await app.request('/')).text()).not.toContain('ria.fake@example.invalid');
db.prepare("UPDATE shifts SET starts_at_utc = '2026-10-14T14:00:00.000Z', ends_at_utc = '2026-10-14T17:00:00.000Z' WHERE id = ?").run(shiftId);
const afterEnd = await postForm(app, `/admin/signups/${signupId}/attendance`, cookie, { mark: 'no-show' });
expect(afterEnd.status).toBe(303);
expect(db.prepare('SELECT attended AS attended FROM signups WHERE id = ?').get(signupId)).toEqual({ attended: 0 });
await postForm(app, `/admin/signups/${signupId}/cancel`, cookie, {});
const blocked = await postForm(app, `/admin/signups/${signupId}/attendance`, cookie, { mark: 'attended' });
expect(blocked.status).toBe(400);
expect(await blocked.text()).toContain('That signup is cancelled.');
expect(db.prepare('SELECT attended AS attended FROM signups WHERE id = ?').get(signupId)).toEqual({ attended: 0 });
const closedRoster = await (await app.request(`/admin/shifts/${shiftId}`, { headers: { cookie } })).text();
expect(closedRoster).not.toContain(`/admin/signups/${signupId}/attendance`);
expect(auditJson(db)).not.toContain('@');
const bare = await app.request(`/admin/signups/${signupId}/attendance`, {
method: 'POST',
headers: { origin: ORIGIN, 'content-type': 'application/x-www-form-urlencoded', cookie },
body: new URLSearchParams({ mark: 'attended' }),
});
expect(bare.status).toBe(403);
expect(db.prepare('SELECT attended AS attended FROM signups WHERE id = ?').get(signupId)).toEqual({ attended: 0 });
});
it('rejects a coordinator form without its matching token', async () => {
const { app, db } = await buildApp();
const cookie = await signIn(app, db);
@@ -551,7 +488,7 @@ describe('coordinator screens', () => {
});
expect(added.status).toBe(303);
const signupId = signupIdFor(db, 'kim@example.invalid');
db.prepare('UPDATE signups SET phone = ?, notes = ?, reminders_off = 1, attended = 1 WHERE id = ?').run('712-555-0199', 'Blue shirt', signupId);
db.prepare('UPDATE signups SET phone = ?, notes = ?, reminders_off = 1 WHERE id = ?').run('712-555-0199', 'Blue shirt', signupId);
const oldToken = manageToken(db, signupId, 'confirmation');
db.prepare(
`INSERT INTO outbox (
@@ -569,20 +506,18 @@ describe('coordinator screens', () => {
expect(moved.status).toBe(303);
expect(moved.headers.get('location')).toBe(`/admin/shifts/${destinationId}?notice=moved`);
const source = db.prepare('SELECT status, attended, shift_id FROM signups WHERE id = ?').get(signupId) as {
const source = db.prepare('SELECT status, shift_id FROM signups WHERE id = ?').get(signupId) as {
status: string;
attended: number;
shift_id: number;
};
expect(source).toEqual({ status: 'cancelled', attended: 1, shift_id: sourceId });
expect(source).toEqual({ status: 'cancelled', shift_id: sourceId });
expect(readManageSignup(db, oldToken, NOW)).toBeNull();
const created = db.prepare(
`SELECT id, status, attended, phone, notes, reminders_off, is_minor, guardian_name, guardian_email, shift_id
`SELECT id, status, phone, notes, reminders_off, is_minor, guardian_name, guardian_email, shift_id
FROM signups WHERE shift_id = ? AND status = 'confirmed'`,
).get(destinationId) as {
id: number;
status: string;
attended: number | null;
phone: string;
notes: string;
reminders_off: number;
@@ -593,7 +528,6 @@ describe('coordinator screens', () => {
};
expect(created).toMatchObject({
status: 'confirmed',
attended: null,
phone: '712-555-0199',
notes: 'Blue shirt',
reminders_off: 1,
@@ -625,7 +559,7 @@ describe('coordinator screens', () => {
const roster = await (await app.request(moved.headers.get('location') ?? '', { headers: { cookie } })).text();
expect(roster).toContain('They are on this shift. A change email is queued.');
expect(roster).toContain('Kim Example');
expect(roster).toContain('Attendance is not marked.');
expect(roster).not.toContain('No-show');
const sourceRoster = await (await app.request(`/admin/shifts/${sourceId}`, { headers: { cookie } })).text();
expect(sourceRoster).not.toContain(`/admin/signups/${signupId}/move`);
expect(sourceRoster).toContain('0/2 spots filled');
@@ -636,7 +570,6 @@ describe('coordinator screens', () => {
expect(home).not.toContain('Blue shirt');
expect(home).toContain('Kim Example');
expect(shiftPage).not.toContain('kim@example.invalid');
expect(shiftPage).not.toContain('Attended.');
expect(auditJson(db)).not.toContain('@');
});
+3 -6
View File
@@ -161,7 +161,6 @@ describe('manage-link switch', () => {
const destinationId = insertShift(db, eventId, 'Distribution', '2026-10-17T14:00:00.000Z', '2026-10-17T17:00:00.000Z', 2);
const { managePath } = await openManage(app, shiftId, 'pat.switch@example.invalid', '203.0.113.40');
const signupId = Number((db.prepare('SELECT id AS id FROM signups').get() as { id: number }).id);
db.prepare('UPDATE signups SET attended = 1 WHERE id = ?').run(signupId);
db.prepare(
`INSERT INTO outbox (
dedupe_key, signup_id, shift_id, kind, to_email, subject, body_text, body_html,
@@ -190,17 +189,15 @@ describe('manage-link switch', () => {
expect(nextHtml).toContain('Confirmed');
expect(await (await app.request(managePath)).status).toBe(404);
expect(db.prepare('SELECT status, attended, shift_id FROM signups WHERE id = ?').get(signupId)).toEqual({
expect(db.prepare('SELECT status, shift_id FROM signups WHERE id = ?').get(signupId)).toEqual({
status: 'cancelled',
attended: 1,
shift_id: shiftId,
});
const created = db.prepare("SELECT status, attended, shift_id FROM signups WHERE status = 'confirmed'").get() as {
const created = db.prepare("SELECT status, shift_id FROM signups WHERE status = 'confirmed'").get() as {
status: string;
attended: number | null;
shift_id: number;
};
expect(created).toEqual({ status: 'confirmed', attended: null, shift_id: destinationId });
expect(created).toEqual({ status: 'confirmed', shift_id: destinationId });
expect(db.prepare("SELECT status FROM outbox WHERE kind = 'confirmation'").get()).toEqual({ status: 'cancelled' });
expect(db.prepare("SELECT status FROM outbox WHERE kind = 'reminder'").get()).toEqual({ status: 'cancelled' });
expect(db.prepare("SELECT COUNT(*) AS n FROM outbox WHERE kind = 'cancelled'").get()).toEqual({ n: 0 });
+2 -2
View File
@@ -398,7 +398,7 @@ function insertAnonymized(db: Database.Database, shiftId: number): void {
db.prepare(
`INSERT INTO signups (
shift_id, name, email, email_norm, phone, is_minor, guardian_name, guardian_email, group_size,
notes, status, manage_token_hash, token_expires_at, reminders_off, attended, created_at, updated_at, anonymized_at
) VALUES (?, NULL, NULL, NULL, NULL, 0, NULL, NULL, 1, NULL, 'confirmed', NULL, NULL, 0, NULL, ?, ?, ?)`,
notes, status, manage_token_hash, token_expires_at, reminders_off, created_at, updated_at, anonymized_at
) VALUES (?, NULL, NULL, NULL, NULL, 0, NULL, NULL, 1, NULL, 'confirmed', NULL, NULL, 0, ?, ?, ?)`,
).run(shiftId, INSTANT, INSTANT, INSTANT);
}
+6 -9
View File
@@ -34,8 +34,8 @@ describe('roster export', () => {
const eventId = insertEvent(db, 'weekly', 'Weekly pantry');
const shiftId = insertShift(db, eventId, '2026-10-15T14:00:00.000Z', '2026-10-15T17:00:00.000Z');
const other = insertShift(db, eventId, '2026-10-17T14:00:00.000Z', '2026-10-17T17:00:00.000Z');
insertSignup(db, shiftId, { name: '=Ada', email: 'ada@example.invalid', notes: 'Blue, shirt', attended: 1 });
insertSignup(db, shiftId, { name: 'Ben', email: 'ben@example.invalid', status: 'cancelled', attended: 0 });
insertSignup(db, shiftId, { name: '=Ada', email: 'ada@example.invalid', notes: 'Blue, shirt' });
insertSignup(db, shiftId, { name: 'Ben', email: 'ben@example.invalid', status: 'cancelled' });
insertSignup(db, shiftId, { name: null, email: null, anonymized: true });
insertSignup(db, other, { name: 'Cam', email: 'cam@example.invalid' });
@@ -48,13 +48,12 @@ describe('roster export', () => {
expect(text).toContain('"Blue, shirt"');
expect(text).toContain('ada@example.invalid');
expect(text).toContain('Cancelled');
expect(text).toContain('No-show');
expect(text).toContain('Attended');
expect(text).not.toContain('Attended');
expect(text).toContain('2026-10-15');
expect(text).toContain('America/Chicago (CDT)');
expect(text).not.toContain('cam@example.invalid');
expect(text).not.toContain('Cam');
const anonymized = text.split('\r\n').find((line) => line.includes(',Confirmed,') && !line.includes('@'));
const anonymized = text.split('\r\n').find((line) => line.endsWith(',Confirmed') && !line.includes('@'));
expect(anonymized).toBeTruthy();
});
@@ -173,7 +172,6 @@ function insertSignup(
notes?: string | null;
phone?: string | null;
status?: string;
attended?: number | null;
anonymized?: boolean;
},
): void {
@@ -181,8 +179,8 @@ function insertSignup(
db.prepare(
`INSERT INTO signups (
shift_id, name, email, email_norm, phone, is_minor, guardian_name, guardian_email, group_size, notes,
status, reminders_off, attended, created_at, updated_at, anonymized_at
) VALUES (?, ?, ?, ?, ?, 0, NULL, NULL, 1, ?, ?, 0, ?, ?, ?, ?)`,
status, reminders_off, created_at, updated_at, anonymized_at
) VALUES (?, ?, ?, ?, ?, 0, NULL, NULL, 1, ?, ?, 0, ?, ?, ?)`,
).run(
shiftId,
anonymized ? null : options.name,
@@ -191,7 +189,6 @@ function insertSignup(
anonymized ? null : options.phone ?? null,
anonymized ? null : options.notes ?? null,
options.status ?? 'confirmed',
options.attended ?? null,
NOW,
NOW,
anonymized ? NOW : null,
+1
View File
@@ -36,6 +36,7 @@ describe('public pages', () => {
expect(html).toContain('Wednesday Sorting');
expect(html).toContain('Wednesday Greeting');
expect(html).toContain('Lane Wednesday');
expect(html).toContain('class="roster-mark" src="/img/sunburst.png?v=');
expect(html).toContain('Live Greeting');
expect(html).toContain('0/2 spots filled');
expect(html).toContain('1/4 spots filled');
+11 -16
View File
@@ -27,8 +27,8 @@ describe('retention cleanup', () => {
const eventId = insertEvent(db, 'pantry', 'America/Chicago');
const oldShift = insertShift(db, eventId, '2024-06-01T16:00:00.000Z', '2024-06-01T17:00:00.000Z');
const recentShift = insertShift(db, eventId, '2026-06-14T16:00:00.000Z', '2026-06-14T17:00:00.000Z');
insertSignup(db, oldShift, 'Old Volunteer', 'old.volunteer@example.invalid', 1, 1);
insertSignup(db, recentShift, 'New Volunteer', 'new.volunteer@example.invalid', 0, null);
insertSignup(db, oldShift, 'Old Volunteer', 'old.volunteer@example.invalid', 1);
insertSignup(db, recentShift, 'New Volunteer', 'new.volunteer@example.invalid', 0);
const result = runRetention(db, NOW);
expect(result.signups).toBe(1);
@@ -44,14 +44,12 @@ describe('retention cleanup', () => {
notes: null,
manage_token_hash: null,
status: 'confirmed',
attended: 1,
anonymized_at: NOW,
});
expect(signup(db, recentShift).name).toBe('New Volunteer');
const csv = exportShiftRoster(db, oldShift)?.csv ?? '';
expect(csv).not.toContain('old.volunteer@example.invalid');
expect(csv).not.toContain(',No,');
expect(csv).toContain('Attended');
expect(JSON.stringify(db.prepare('SELECT detail_json AS detail_json FROM audit').all())).not.toContain('@');
});
@@ -61,8 +59,8 @@ describe('retention cleanup', () => {
const eventId = insertEvent(db, 'pantry', 'America/Chicago');
const dueShift = insertShift(db, eventId, '2026-04-01T16:00:00.000Z', '2026-04-01T17:00:00.000Z');
const earlyShift = insertShift(db, eventId, '2026-06-01T16:00:00.000Z', '2026-06-01T17:00:00.000Z');
const dueSignup = insertSignup(db, dueShift, 'Due Volunteer', 'due.volunteer@example.invalid', 0, null);
insertSignup(db, earlyShift, 'Early Volunteer', 'early.volunteer@example.invalid', 0, null);
const dueSignup = insertSignup(db, dueShift, 'Due Volunteer', 'due.volunteer@example.invalid', 0);
insertSignup(db, earlyShift, 'Early Volunteer', 'early.volunteer@example.invalid', 0);
insertOutbox(db, {
dedupe: 'confirmation:v1:due:due.volunteer@example.invalid',
signupId: dueSignup,
@@ -87,7 +85,7 @@ describe('retention cleanup', () => {
const db = await openDb();
const eventId = insertEvent(db, 'pantry', 'America/Chicago');
const shiftId = insertShift(db, eventId, '2026-06-14T16:00:00.000Z', '2026-06-14T17:00:00.000Z');
const signupId = insertSignup(db, shiftId, 'Mail Volunteer', 'mail.volunteer@example.invalid', 0, null);
const signupId = insertSignup(db, shiftId, 'Mail Volunteer', 'mail.volunteer@example.invalid', 0);
insertOutbox(db, {
dedupe: 'confirmation:v1:1:mail.volunteer@example.invalid',
signupId,
@@ -210,10 +208,10 @@ describe('retention cleanup', () => {
const db = await openDb();
const eventId = insertEvent(db, 'pantry', 'America/Chicago');
const shiftId = insertShift(db, eventId, '2024-06-01T16:00:00.000Z', '2024-06-01T17:00:00.000Z');
insertSignup(db, shiftId, 'Clock Volunteer', 'clock.volunteer@example.invalid', 0, null);
insertSignup(db, shiftId, 'Clock Volunteer', 'clock.volunteer@example.invalid', 0);
const broken = insertEvent(db, 'broken', 'Not/AZone');
const brokenShift = insertShift(db, broken, '2024-06-01T16:00:00.000Z', '2024-06-01T17:00:00.000Z');
insertSignup(db, brokenShift, 'Broken Volunteer', 'broken.volunteer@example.invalid', 0, null);
insertSignup(db, brokenShift, 'Broken Volunteer', 'broken.volunteer@example.invalid', 0);
expect(runDueRetention(db, BEFORE)).toMatchObject({ ran: false });
expect(signup(db, shiftId).name).toBe('Clock Volunteer');
@@ -239,7 +237,7 @@ describe('retention cleanup', () => {
const fall = await openDb();
const fallEvent = insertEvent(fall, 'pantry', 'America/Chicago');
const fallShift = insertShift(fall, fallEvent, '2024-06-01T16:00:00.000Z', '2024-06-01T17:00:00.000Z');
insertSignup(fall, fallShift, 'Fall Volunteer', 'fall.volunteer@example.invalid', 0, null);
insertSignup(fall, fallShift, 'Fall Volunteer', 'fall.volunteer@example.invalid', 0);
const firstHour = localUtc('2026-11-01', 1, 0, 'earlier');
const secondHour = localUtc('2026-11-01', 1, 30, 'later');
expect(runDueRetention(fall, firstHour).ran).toBe(true);
@@ -251,7 +249,7 @@ describe('retention cleanup', () => {
const db = await openDb();
const eventId = insertEvent(db, 'pantry', 'America/Chicago');
const shiftId = insertShift(db, eventId, '2024-06-01T16:00:00.000Z', '2024-06-01T17:00:00.000Z');
insertSignup(db, shiftId, 'Runner Volunteer', 'runner.volunteer@example.invalid', 0, null);
insertSignup(db, shiftId, 'Runner Volunteer', 'runner.volunteer@example.invalid', 0);
const runner = startRetentionRunner(db, () => NOW);
expect(signup(db, shiftId).name).toBeNull();
runner.stop();
@@ -304,15 +302,14 @@ function insertSignup(
name: string,
email: string,
isMinor: number,
attended: number | null,
): number {
return Number(
db.prepare(
`INSERT INTO signups (
shift_id, name, email, email_norm, phone, is_minor, guardian_name, guardian_email,
group_size, notes, status, manage_token_hash, token_expires_at, reminders_off,
attended, created_at, updated_at, anonymized_at
) VALUES (?, ?, ?, ?, '555-0100', ?, ?, ?, 1, 'Bring a pen', 'confirmed', ?, ?, 0, ?, ?, ?, NULL)`,
created_at, updated_at, anonymized_at
) VALUES (?, ?, ?, ?, '555-0100', ?, ?, ?, 1, 'Bring a pen', 'confirmed', ?, ?, 0, ?, ?, NULL)`,
).run(
shiftId,
name,
@@ -323,7 +320,6 @@ function insertSignup(
isMinor ? 'guardian.pat@example.invalid' : null,
`hash-${email}`,
'2026-06-20T15:00:00.000Z',
attended,
NOW,
NOW,
).lastInsertRowid,
@@ -374,7 +370,6 @@ function signup(db: Awaited<ReturnType<typeof openDb>>, shiftId: number) {
notes: string | null;
manage_token_hash: string | null;
status: string;
attended: number | null;
anonymized_at: string | null;
};
}