Skip to content

Ask about long visits before checking everyone out - #35

Merged
gbyo merged 5 commits into
mainfrom
gibby/checkout-reminder-long-visits-02e337
Aug 11, 2026
Merged

gbyo merged 5 commits into
mainfrom
gibby/checkout-reminder-long-visits-02e337

Conversation

@gbyo

@gbyo gbyo commented Aug 11, 2026

Copy link
Copy Markdown
Member

Two related fixes for visits where a student forgot to scan out.

Checkout reminder on the live roster

Clicking Check everyone out when 2 or more students have been checked in for more than 30 minutes now opens a review dialog instead of the plain confirm:

  • Each long visit is listed with name, check-in time, and time here, plus a minutes field pre-filled with their current elapsed time
  • Set all to … / Apply to all retimes the whole group at once, capped per student at their actual time checked in (the toast says how many were capped)
  • Confirming checks out everyone in the library; only rows you actually changed get a corrected duration, and check-in times never move
  • With 0 or 1 long visits, the original confirm dialog is unchanged

New POST /api/library/admin-clear-with-durations clears through the existing path first, so every student still gets their Google Sheets event, then rewrites the corrected checkout times.

Multi-select duration editing in History

A checkbox column leads the history table. Selecting rows reveals a bar with N visits selected · Edit duration · Clear selection, opening an editor with one minutes field per selected visit plus the same Apply to all control.

  • Only editable rows get a checkbox — visits still checked in have no checkout to move, and the archived view has none at all, matching the existing single-row editor
  • The header checkbox selects every editable row on the page and goes indeterminate on a partial selection
  • Selection clears whenever the table reloads (page, filter, or view change)

New POST /api/library/admin-update-visit-durations validates the entire batch before writing, so one stale row cannot leave the rest half applied.

Structure

Follows the existing layer-on-layer pattern: admin-v6 → admin-v7 on the worker chain, admin-ui-v8 → admin-ui-v9 on the markup chain, with access-router.ts and admin-ui.ts repointed at the new heads.

Testing

tsc --noEmit clean, no console errors. Both endpoints were exercised against a SQLite-backed D1 stand-in and both UIs were driven in a browser:

  • 3 long visits: Ada corrected 214→30 min, Alan 97→45, Grace left alone → history recorded 30/45/43; Katherine (6 min, never in the dialog) got a normal checkout. All 4 CLEAR_ALL sheet events fired.
  • Apply-to-all with 45 capped Grace at her 41 min and reported it
  • 1 long visit falls back to the original confirm dialog and clears normally
  • Bulk edit: Grace + Ada set to 40 min each; unselected Alan stayed 170, Katherine 28
  • Select-all picked 4 of 5 rows, skipping the still-checked-in visit
  • Rejected, leaving every row in the batch untouched: still-checked-in (409), archived (409), unknown id (404), checkout in the future (400), fractional / out-of-range / non-array (400), wrong method (405)
  • Client-side guards keep the modal open on over-max, empty, and no-change saves; Escape and backdrop close cleanly
  • The per-row Edit duration button from Allow editing completed visit duration #34 still targets the right visit despite the added column

🤖 Generated with Claude Code

gbyo and others added 5 commits August 11, 2026 13:39
Checks everyone out through the existing clear path so every visit still
gets its sheet event, then moves the checkout times the librarian corrected.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Check everyone out now asks about visits over 30 minutes when more than
one student is affected, so forgotten checkouts can be retimed first.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Validates the whole batch before writing so one stale row cannot leave
the rest half applied.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Select several visits and correct their durations together.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions github-actions Bot added the area:source Changes to application source code label Aug 11, 2026
@cloudflare-workers-and-pages

Copy link
Copy Markdown
Contributor

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
flow b79cb97 Aug 11 2026, 05:40 PM

@gbyo
gbyo merged commit dbac868 into main Aug 11, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:source Changes to application source code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant