fix(school): show Nursery only for nursery classes, and say Girls' school #175

Merged
tudor merged 2 commits from fix/header-nursery-and-gender into main 2026-10-02 22:04:29 +00:00
Owner

GIAS NurseryProvision is text (Has Nursery Classes, No Nursery Classes, Not applicable), but the school header and the place-page table tested it for truthiness. So every school with a value got a Nursery chip (or a "Yes"), including secondaries aged 11–18: Graveney, Burntwood, St Cecilia's, Tiffin, Swanshurst. Separately, the single-sex chip appended 's to the plural GIAS gender, giving "Girls's school".

Changes

  • hasNurseryClasses() matches only Has Nursery Classes; used by SchoolDetailShell and PlaceView.
  • singleSexLabel() returns Girls' school / Boys' school, or null for mixed/unknown.
  • School.nursery_provision is typed string | null, which is what the API sends.

Tests

  • New schoolDetailHeader.test.tsx: chip shown for Has Nursery Classes, hidden for the other values and null; plural possessive for girls/boys; nothing for mixed.
  • PlaceView fixtures now use real GIAS strings, plus a case that Not applicable is not a "Yes".
  • Helper unit tests in utils.test.ts.
  • E2E journey: a girls' secondary header reads Girls' school, and shows Nursery only when the detail API says Has Nursery Classes. Run against staging before the fix, it fails as expected (Swanshurst renders Girls's school … Nursery).

tsc --noEmit clean; Jest 68 suites / 582 tests pass.

First step from the header proposal; the layout redesign follows separately.

🤖 Generated with Claude Code

GIAS `NurseryProvision` is text (`Has Nursery Classes`, `No Nursery Classes`, `Not applicable`), but the school header and the place-page table tested it for truthiness. So every school with a value got a **Nursery** chip (or a "Yes"), including secondaries aged 11–18: Graveney, Burntwood, St Cecilia's, Tiffin, Swanshurst. Separately, the single-sex chip appended `'s` to the plural GIAS gender, giving **"Girls's school"**. ## Changes - `hasNurseryClasses()` matches only `Has Nursery Classes`; used by `SchoolDetailShell` and `PlaceView`. - `singleSexLabel()` returns `Girls' school` / `Boys' school`, or null for mixed/unknown. - `School.nursery_provision` is typed `string | null`, which is what the API sends. ## Tests - New `schoolDetailHeader.test.tsx`: chip shown for `Has Nursery Classes`, hidden for the other values and null; plural possessive for girls/boys; nothing for mixed. - `PlaceView` fixtures now use real GIAS strings, plus a case that `Not applicable` is not a "Yes". - Helper unit tests in `utils.test.ts`. - E2E journey: a girls' secondary header reads `Girls' school`, and shows Nursery only when the detail API says `Has Nursery Classes`. Run against staging before the fix, it fails as expected (Swanshurst renders `Girls's school … Nursery`). `tsc --noEmit` clean; Jest 68 suites / 582 tests pass. First step from the header proposal; the layout redesign follows separately. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
tudor added 1 commit 2026-10-02 21:02:43 +00:00
fix(school): show Nursery only for nursery classes, and say Girls' school
PR Checks / Frontend Typecheck + Tests (pull_request) Successful in 1m13s
PR Checks / Backend Smoke (pull_request) Successful in 10s
PR Checks / Build Backend (no push) (pull_request) Successful in 18s
PR Checks / Build Frontend (no push) (pull_request) Successful in 1m19s
PR Checks / Build Pipeline (no push) (pull_request) Successful in 11s
PR Checks / AI Code Review (Claude) (pull_request) Successful in 16s
dea435a906
GIAS NurseryProvision is text ("Has Nursery Classes", "No Nursery
Classes", "Not applicable"), but the header and the place table tested it
for truthiness. Every school with a value got a Nursery chip or a "Yes",
including secondaries aged 11-18. hasNurseryClasses() matches the one
value that means a nursery, and the type now says the field is a string.

The single-sex chip appended 's to the plural GIAS gender, giving
"Girls's school". singleSexLabel() gives "Girls' school" / "Boys' school".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

🤖 AI Code Review (Claude Code)

Fixes the school header and places table to treat GIAS nursery_provision as text rather than a boolean, via a new hasNurseryClasses helper. It also fixes the single-sex label to read "Girls' school" / "Boys' school" via singleSexLabel. The change is small and correct, and it adds unit, component and e2e tests.

🟡 Minor

  • e2e/tests/journeys.spec.ts: The e2e test relies on the /api/schools list supporting a gender=girls filter and on search=school matching. If the filter is unsupported or silently ignored, the returned school may not be girls-only and the test will fail with a misleading error instead of skipping. The detail.school_info.nursery_provision field name is also assumed and not checked against the API response shape.
  • nextjs-app/tests/components/schoolDetailHeader.test.tsx: The 'says nothing for a mixed school' assertion uses /school$/ with a span selector. It would also match unrelated spans ending in 'school', and it does not guard against 'Girls' school' variants that end in a different form, so it is weak. The withSchool helper is also loosely typed (info: object).
  • nextjs-app/lib/utils.ts: singleSexLabel compares case-sensitively against 'Girls' and 'Boys', while hasNurseryClasses is case-insensitive. Inconsistent normalization could silently drop the chip if GIAS casing varies.
## 🤖 AI Code Review (Claude Code) Fixes the school header and places table to treat GIAS nursery_provision as text rather than a boolean, via a new hasNurseryClasses helper. It also fixes the single-sex label to read "Girls' school" / "Boys' school" via singleSexLabel. The change is small and correct, and it adds unit, component and e2e tests. ### 🟡 Minor - **e2e/tests/journeys.spec.ts**: The e2e test relies on the /api/schools list supporting a `gender=girls` filter and on `search=school` matching. If the filter is unsupported or silently ignored, the returned school may not be girls-only and the test will fail with a misleading error instead of skipping. The `detail.school_info.nursery_provision` field name is also assumed and not checked against the API response shape. - **nextjs-app/__tests__/components/schoolDetailHeader.test.tsx**: The 'says nothing for a mixed school' assertion uses `/school$/` with a span selector. It would also match unrelated spans ending in 'school', and it does not guard against 'Girls' school' variants that end in a different form, so it is weak. The `withSchool` helper is also loosely typed (`info: object`). - **nextjs-app/lib/utils.ts**: `singleSexLabel` compares case-sensitively against 'Girls' and 'Boys', while `hasNurseryClasses` is case-insensitive. Inconsistent normalization could silently drop the chip if GIAS casing varies.
tudor added 1 commit 2026-10-02 21:16:50 +00:00
fix(school): address review on the header chip fixes
PR Checks / Frontend Typecheck + Tests (pull_request) Successful in 1m13s
PR Checks / Backend Smoke (pull_request) Successful in 10s
PR Checks / Build Backend (no push) (pull_request) Successful in 17s
PR Checks / Build Frontend (no push) (pull_request) Successful in 1m18s
PR Checks / Build Pipeline (no push) (pull_request) Successful in 11s
PR Checks / AI Code Review (Claude) (pull_request) Successful in 15s
e3f21a5bc7
- E2E: list with page_size (per_page was ignored), fail clearly if the
  gender filter is ignored, and require nursery_provision on the detail
  payload so the Nursery assertion cannot pass vacuously.
- singleSexLabel ignores case, as hasNurseryClasses does.
- Header test: type withSchool with Partial<School>, and match the
  single-sex labels exactly instead of any span ending in "school".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

🤖 AI Code Review (Claude Code)

Replaces boolean-style truthiness checks on GIAS text fields in the school header and place table with helpers (hasNurseryClasses, singleSexLabel). This fixes spurious 'Nursery' chips and the "Girls's school" label. The change is small, well tested with unit and e2e tests, and looks healthy.

🟡 Minor

  • e2e/tests/journeys.spec.ts: The e2e test uses search=school with page_size=1 and assumes the API honours the gender filter. It also locates the header with page.locator('header', { has: h1 }), which could match a different header element. This is brittle but not incorrect, and it skips cleanly when there is no data.
  • nextjs-app/lib/types.ts: The nursery_provision type changes from boolean to string. Other consumers, such as comparison views or API mocks that still pass booleans, would not be flagged at runtime and now silently read as no nursery. A grep for remaining usages would confirm that none are left.
## 🤖 AI Code Review (Claude Code) Replaces boolean-style truthiness checks on GIAS text fields in the school header and place table with helpers (hasNurseryClasses, singleSexLabel). This fixes spurious 'Nursery' chips and the "Girls's school" label. The change is small, well tested with unit and e2e tests, and looks healthy. ### 🟡 Minor - **e2e/tests/journeys.spec.ts**: The e2e test uses `search=school` with `page_size=1` and assumes the API honours the `gender` filter. It also locates the header with `page.locator('header', { has: h1 })`, which could match a different header element. This is brittle but not incorrect, and it skips cleanly when there is no data. - **nextjs-app/lib/types.ts**: The `nursery_provision` type changes from boolean to string. Other consumers, such as comparison views or API mocks that still pass booleans, would not be flagged at runtime and now silently read as no nursery. A grep for remaining usages would confirm that none are left.
tudor merged commit 807133c305 into main 2026-10-02 22:04:29 +00:00
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: tudor/school_compare#175