feat(admissions): add the cut-off history, map and postcode check
PR Checks / Frontend Typecheck + Tests (pull_request) Successful in 1m3s
PR Checks / Backend Smoke (pull_request) Successful in 7s
PR Checks / Build Backend (no push) (pull_request) Successful in 17s
PR Checks / Build Frontend (no push) (pull_request) Successful in 44s
PR Checks / Build Pipeline (no push) (pull_request) Successful in 10s
PR Checks / AI Code Review (Claude) (pull_request) Successful in 2m39s

Completes the last-distance-offered feature against the mockup: the
year-by-year record, the same numbers drawn over real streets, and the
reader's own address measured against them.

Serving the history
  The first cut deliberately served only the latest year, because a plain
  series would draw a trend line straight through gaps that are absences of
  publication, not of a cut-off. That reasoning is answered rather than
  abandoned: cutoffYearRows classifies every year in the span, and the chart
  breaks the line rather than interpolating across it.

  A missing year is not one fact but three. It may be unpublished; it may be
  a year the school was not oversubscribed; or there may be no record at all.
  Collapsing them into "no data" throws away the reassuring case and hides
  the important caveat, so each is stated in words in the table.

  The claim is held to what the data supports. fact_admissions.oversubscribed
  compares FIRST PREFERENCES against places, which does not establish that
  every applicant was offered one — so the copy says "places available on
  first preferences" and a test asserts the stronger claim never appears.

The trend summary is not a verdict
  It names both endpoints and their years and lets the reader conclude. It is
  withheld below four published points, and a swing under a tenth of the
  earlier figure is reported as "broadly the same" rather than dressed up as
  a direction.

The postcode check
  This is the only place on the site that answers a question about a family
  rather than a school, so most of the care went into what it refuses to say.
  postcodes.io returns a centroid covering roughly fifteen addresses, which
  against a 500 m cut-off is a fifth of the whole distance — so a margin
  inside 100 m returns "too close to call" rather than a place a family does
  not have. Unpublished years count as unknown, never as a pass. The limits
  are stated before the check is used, not revealed with the answer.

  The postcode is geocoded in the browser and never stored.

Both templates
  Banded and selective secondaries are exactly where this matters most, so
  the detail is shared. The primary page gives it a third tab; the secondary
  page is one flat panel by design and renders it inline.

Absence is explained rather than reported. A selective school's missing
figure is explained by how it admits; a consistently undersubscribed school
reads as good news.

Also makes the batch loader's test double honour ORDER BY. It was a no-op,
so "latest row per URN" was really "first row in the fixture" and the test
would have passed with the sort reversed or removed.

Verified: 214 frontend tests, 54 backend, 45/53 e2e green against staging
(the 8 cut-off journeys skip until the DAG runs). Rendered offline against
the real compiled CSS in both themes and at 390px; every new surface clears
WCAG AA, measured on composited pixels.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WDvkyqqHABm4bmth2kjAxE
This commit is contained in:
TudorandClaude Opus 5 committed 2026-08-16 13:42:06 +01:00
1 parent 5a71f54d94
commit a72323874f
24 files changed
+2067 -65

No files matched your search

@@ -2064,3 +2064,383 @@
.secondaryScope .ofstedReportLink { margin-left: 0; display: block; margin-top: 0.25rem; }
.secondaryScope .admissionsTypeBadge { font-size: 0.75rem; }
}
/* ══════════════════════════════════════════════════════════════════════
Last distance offered — the Distance view, map and postcode check
══════════════════════════════════════════════════════════════════════ */
/* Visually hidden but still read aloud. The year strip encodes its verdict as
a glyph, so every chip carries a spelled-out equivalent here — a screen
reader announcing "2025 ✓" tells you nothing. */
.srOnly {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip-path: inset(50%);
white-space: nowrap;
border: 0;
}
.cutoffChartKey {
margin: 0.6rem 0 0;
font-size: 0.8125rem;
line-height: 1.55;
color: var(--text-secondary);
max-width: 68ch;
}
/* ── Year-by-year table ── */
.cutoffTableWrap {
margin-top: 1.25rem;
overflow-x: auto;
}
.cutoffTable {
width: 100%;
border-collapse: collapse;
font-size: 0.875rem;
/* Below this the four columns crush; the wrapper scrolls instead of the
page, so the section itself never scrolls sideways. */
min-width: 26rem;
font-variant-numeric: tabular-nums;
}
.cutoffTable thead th {
text-align: right;
font-size: 0.6875rem;
font-weight: 600;
letter-spacing: 0.04em;
text-transform: uppercase;
color: var(--text-secondary);
padding: 0 0.625rem 0.55rem;
border-bottom: 1px solid var(--border);
white-space: nowrap;
}
.cutoffTable thead th:first-child,
.cutoffTable tbody th {
text-align: left;
}
.cutoffTable tbody td,
.cutoffTable tbody th {
text-align: right;
padding: 0.65rem 0.625rem;
border-bottom: 1px solid var(--border);
font-weight: 400;
color: var(--text-primary);
}
.cutoffTable tbody th {
font-weight: 600;
}
.cutoffTable tbody tr:last-child td,
.cutoffTable tbody tr:last-child th {
border-bottom: none;
}
.cutoffRowLatest td,
.cutoffRowLatest th {
background: var(--bg-secondary);
}
.cutoffCellMissing {
color: var(--text-secondary);
}
.cutoffRouteFlag {
font-size: 0.75rem;
color: var(--text-secondary);
white-space: nowrap;
}
.cutoffPill {
display: inline-block;
font-size: 0.6875rem;
font-weight: 600;
padding: 0.15rem 0.55rem;
border-radius: 999px;
white-space: nowrap;
}
.cutoffPillOver {
background: var(--brand-bg);
color: var(--brand-strong);
}
.cutoffPillOk {
background: var(--status-above-bg);
color: var(--status-above);
}
.cutoffPillNa {
background: var(--bg-secondary);
color: var(--text-secondary);
}
/* ── Map panel ── */
.cutoffMapPanel {
margin-top: 1.75rem;
padding-top: 1.5rem;
border-top: 1px solid var(--border);
}
.cutoffMapTitle {
margin: 0 0 0.85rem;
font-family: var(--font-display);
font-size: 1.1rem;
font-weight: 700;
letter-spacing: -0.01em;
color: var(--text-primary);
}
.cutoffMapFigure {
height: 320px;
border-radius: var(--radius-md);
overflow: hidden;
border: 1px solid var(--border);
background: var(--bg-secondary);
}
.cutoffMapSkeleton {
width: 100%;
height: 100%;
background: var(--bg-secondary);
}
.cutoffMapLegend {
list-style: none;
margin: 0.85rem 0 0;
padding: 0;
display: flex;
flex-wrap: wrap;
gap: 0.5rem 1.25rem;
font-size: 0.8125rem;
color: var(--text-secondary);
}
.cutoffMapLegend li {
display: inline-flex;
align-items: center;
gap: 0.45rem;
}
.cutoffSwatch {
width: 14px;
height: 14px;
border-radius: 50%;
flex: none;
}
.cutoffSwatchNow {
background: var(--brand-bg);
box-shadow: inset 0 0 0 2px var(--brand);
}
.cutoffSwatchPast {
background: transparent;
box-shadow: inset 0 0 0 1.5px var(--brand);
opacity: 0.5;
}
.cutoffSwatchHome {
width: 11px;
height: 11px;
border-radius: 2px;
background: var(--status-above);
transform: rotate(45deg);
}
.cutoffMapCaveat {
margin: 0.75rem 0 0;
font-size: 0.8125rem;
line-height: 1.55;
color: var(--text-secondary);
max-width: 68ch;
}
/* ── Postcode check ── */
.cutoffCheck {
margin-top: 1.5rem;
padding-top: 1.25rem;
border-top: 1px solid var(--border);
}
.cutoffCheckTitle {
margin: 0 0 0.25rem;
font-family: var(--font-display);
font-size: 1rem;
font-weight: 700;
color: var(--text-primary);
}
.cutoffCheckSub {
margin: 0 0 0.85rem;
font-size: 0.8125rem;
line-height: 1.55;
color: var(--text-secondary);
max-width: 62ch;
}
.cutoffCheckForm {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
}
.cutoffCheckInput {
font: inherit;
font-size: 1rem;
padding: 0.6rem 0.8rem;
border: 1px solid var(--border);
border-radius: var(--radius-md);
background: var(--bg-card);
color: var(--text-primary);
text-transform: uppercase;
/* Grows into the row but never past it — at 320px a fixed width would push
the button out of the viewport. */
flex: 1 1 9rem;
/* Stops well short of full width on desktop, where a postcode field
spanning the whole card reads as a search box. */
max-width: 16rem;
min-width: 0;
}
.cutoffCheckInput::placeholder {
text-transform: none;
color: var(--text-secondary);
}
.cutoffCheckInput:focus-visible {
outline: 2px solid var(--brand);
outline-offset: 1px;
border-color: var(--brand);
}
.cutoffCheckButton {
font: inherit;
font-weight: 600;
font-size: 1rem;
padding: 0.6rem 1.25rem;
border: none;
border-radius: var(--radius-md);
background: var(--brand);
color: var(--brand-on);
cursor: pointer;
flex: none;
transition: background var(--transition);
}
.cutoffCheckButton:hover:not(:disabled) {
background: var(--brand-strong);
}
.cutoffCheckButton:disabled {
opacity: 0.65;
cursor: progress;
}
.cutoffCheckButton:focus-visible {
outline: 2px solid var(--brand);
outline-offset: 2px;
}
.cutoffCheckError {
margin: 0.75rem 0 0;
font-size: 0.875rem;
color: var(--status-below);
}
.cutoffCheckResult {
margin-top: 0.9rem;
padding: 0.9rem 1rem;
border-radius: var(--radius-md);
background-color: var(--bg-card);
background-image: linear-gradient(var(--brand-bg), var(--brand-bg));
}
.cutoffCheckHeadline {
margin: 0;
font-family: var(--font-display);
font-size: 1.05rem;
font-weight: 700;
line-height: 1.35;
color: var(--text-primary);
text-wrap: balance;
}
.cutoffCheckDetail {
margin: 0.35rem 0 0;
font-size: 0.8125rem;
line-height: 1.55;
color: var(--text-secondary);
}
.cutoffYearStrip {
list-style: none;
margin: 0.75rem 0 0;
padding: 0;
display: flex;
flex-wrap: wrap;
gap: 0.3rem;
}
.cutoffYearChip {
display: inline-flex;
align-items: center;
gap: 0.3rem;
font-size: 0.75rem;
font-weight: 600;
padding: 0.2rem 0.5rem;
border-radius: 999px;
font-variant-numeric: tabular-nums;
white-space: nowrap;
}
.cutoffYearChipYear {
font-weight: 700;
}
.cutoffYearInside {
background: var(--status-above-bg);
color: var(--status-above);
}
.cutoffYearOutside {
background: var(--status-below-bg);
color: var(--status-below);
}
/* Deliberately neutral rather than a warning colour: "we cannot tell" is not a
bad outcome, and tinting it amber would read as one. */
.cutoffYearTooClose {
background: var(--bg-secondary);
color: var(--text-primary);
box-shadow: inset 0 0 0 1px var(--border);
}
.cutoffYearUnknown {
background: var(--bg-secondary);
color: var(--text-secondary);
}
.cutoffCheckCaveat {
margin: 0.9rem 0 0;
font-size: 0.8125rem;
line-height: 1.55;
color: var(--text-secondary);
max-width: 68ch;
}
@media (max-width: 640px) {
.cutoffMapFigure {
height: 260px;
}
}