diff --git a/CLAUDE.md b/CLAUDE.md index 8a1c794..42af622 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -7,12 +7,13 @@ `0014_add_absence`, `0015_absence_project` are deployed; `/history/` is no longer crashing on the production VM. The Worker Absences feature shipped on 14 May 2026 (commits `bf6f0a5` → `27fe05e` on -`ai-dev`). Subsequent UX polish (multi-checkbox-dropdown stacking -fix, absence-form team-filter bug fix, team filter added to -`/workers/` and `/history/`) is on `ai-dev` HEAD but not yet on +`ai-dev`). **6 subsequent commits** of UX polish + cleanup +(team-filter bug fix, dropdown stacking fix, team filter on +`/workers/` and `/history/`, day-name in payroll modal, 7 small +code-review polish items) are on `ai-dev` HEAD but not yet on production — needs a `git pull` + `sudo systemctl restart django-dev.service` whenever convenient (no migrations or -collectstatic required for those commits). +collectstatic required for any of them). Phase A.2 (manual JournalEntry UI) and Phase B (Letterly inbound webhook) from the Site Work Logging design are parked pending Q5 / Q7 diff --git a/docs/plans/parked-work.md b/docs/plans/parked-work.md index 5575545..d64336d 100644 --- a/docs/plans/parked-work.md +++ b/docs/plans/parked-work.md @@ -23,6 +23,8 @@ that are NOT yet on production: | `02c6d4d` | Fixes the Reasons multi-checkbox dropdown stacking-context bug on `/absences/` (lifted the filter card above the table card) | | `4b57cff` | Adds a Team filter to `/workers/` | | `398a5b2` | Adds a Team filter to `/history/` (and CSV export) | +| `70fa085` | Shows day name in Work Log Payroll modal header ("Friday, 15 May 2026") | +| `d1d3e15` | 7 absence-feature polish follow-ups (dead code removal, N+1 fixes, DRY helpers, WCAG icon contrast) | **To deploy these:** - No migrations needed (pure template + view changes; no schema changes). @@ -77,42 +79,10 @@ verification, shared-secret URL token. ## Small polish follow-ups from the Absences feature -These were flagged during code review of the absences feature but -deemed non-blocking. They can roll into a future janitorial pass. - -- **`AbsenceQuickForm` is defined but never wired up** — - `core/forms.py:797-827`. Originally planned for a per-worker ✗ - modal on the attendance form, but Round C replaced that paradigm - with the "Submit + Log Absences" button. Either wire the form up - somewhere or delete the class. ~30 LOC. -- **N+1 in `team_workers_map` build** — affects both `attendance_log` - and `absence_log`. Pre-existing in `attendance_log`; Round A - inherited the pattern. Fix is to use - `Prefetch('workers', queryset=Worker.objects.filter(active=True), - to_attr='active_workers_cached')` like the payroll dashboard does. - Recommend extracting `_build_team_workers_map(user)` as a shared - helper. -- **`absence_list` permission check duplicates `_user_can_log_absences`** — - `core/views.py:5535` inlines `is_admin(user) or - user.supervised_teams.exists()` instead of calling the helper. - Trivial DRY cleanup. -- **`--badge-neutral-bg` referenced but never defined** — - `static/css/custom.css` near line 2197. The CSS uses - `var(--badge-neutral-bg, #6c757d)` for `.badge-absence-unpaid` and - `.badge-absence-other`; the fallback always wins because the - variable isn't declared in `:root`. Either define it in both - themes or drop the `var()` wrapper. -- **`conflicting_worklogs()` runs N queries per (worker, date) pair** — - `core/forms.py:785-786`. Fine at FoxFitt's scale. Worth profiling - if/when batch sizes grow. -- **CSV export filter block is duplicated** — `core/views.py` - `absence_export_csv` copies the filter logic from `absence_list`. - TODO comment in code says "factor into `_apply_absence_filters` - when a third filter joins." -- **Paid-checkmark icon in `site_report_detail.html`** uses - `color: var(--badge-bonus-bg)` (a BACKGROUND color) as foreground - — fails WCAG contrast on white. Same fix as we applied to absence - templates (use `text-success`). Trivial one-line change. +> All 7 cleared on 15 May 2026 (commit `d1d3e15`). Kept the section +> header in place because more polish items will accumulate from +> future code reviews — when they do, append here. The shipped items +> are summarized under "Recently shipped" below. --- @@ -133,6 +103,26 @@ From Q9, Q4 of the Site Work Logging brainstorm: ## Recently shipped (for context, so a fresh session knows what just landed) +- **Absence-feature polish pass** (commit `d1d3e15`, 15 May 2026): + Seven small cleanups in one focused commit. (1) Deleted unused + `AbsenceQuickForm` (Round C made it obsolete). (2) Extracted + `_build_team_workers_map(user)` helper using `Prefetch(..., to_attr=...)`, + fixing N+1 on both `attendance_log` and `absence_log` (one query + instead of one-per-team). (3) `absence_list` now calls the existing + `_user_can_log_absences` helper. (4) Removed undefined + `var(--badge-neutral-bg)` CSS wrapper — fallback hex was always + winning anyway. (5) `conflicting_worklogs()` rewritten as a single + query with Python-side pair-set filtering — 25-query → 2-query for + a 5×5 form. (6) Extracted `_apply_absence_filters(qs, request)` + shared by `absence_list` + `absence_export_csv` so adding a filter + param now touches one place, not two. (7) `site_report_detail.html` + paid-check icon uses `text-success` instead of background-color + variable as foreground (WCAG contrast fix). 157/157 tests still + green. +- **Day name in Work Log Payroll modal header** (commit `70fa085`, + 15 May 2026): The modal opened from /history/ now shows + "Friday, 15 May 2026" instead of "2026-05-15". Pure server-side + `strftime` on the already-loaded `log.date` — zero overhead. - **Team filters on `/workers/` and `/history/`** (commits `4b57cff`, `398a5b2`, 15 May 2026): Both pages now have a Team dropdown in their filter row. `/workers/?team=` filters by Team.workers