/** * Getting a place — admissions framed the way the expert review requires: * total applications are "named on N forms" (any preference rank, not * head-to-head), one consistent chip metric (first-preference success), * equal-preference and offers-vs-intake explanations up front. */ 'use client'; import { summariseAdmissions } from '@/lib/compareLogic'; import type { ComparisonData, School } from '@/lib/types'; import { CHART_COLORS } from '@/lib/utils'; import { Cell, Chip, Measure, Section, SectionGrid, sectionStyles as s } from './sectionShared'; export function CompareAdmissions({ schools, data, }: { schools: School[]; data: Record; }) { const rows = schools.map((school) => data[String(school.urn)]?.admissions ?? null); const anyData = rows.some(Boolean); const entryYear = rows.find(Boolean)?.year; const entryLabel = entryYear ? `September ${String(entryYear).slice(0, 4)} entry` : 'the most recent admissions round'; if (!anyData) { return (
<>
); } return (
From the most recent admissions round ({entryLabel}). "First choice" means families who ranked the school top of their application form — officially a "first preference". Schools never see your ranking: places are decided only by the school's admission criteria, so listing a school lower down never hurts your chances. These are National Offer Day offers — waiting lists and appeals can change the final intake. } > {schools.map((school, i) => { const a = rows[i]; return ( {a?.total_applications != null && a?.places_offered != null ? ( <> Named on {a.total_applications.toLocaleString('en-GB')} forms ·{' '} {a.places_offered.toLocaleString('en-GB')} places ) : ( No data )} ); })} {schools.map((school, i) => { const summary = summariseAdmissions(rows[i]); return ( {summary.firstPrefPct != null ? ( <> {summary.firstPrefPct}%{' '} {summary.chip && summary.chip.tone === 'warn' && ( {summary.chip.text} )} ) : ( No data )} ); })} {schools.map((school, i) => { const a = rows[i]; const summary = summariseAdmissions(a); let text: string | null = null; if (summary.firstPrefPct != null) { if (summary.firstPrefPct >= 100) { text = `Every family who put ${school.school_name} first got a place.`; } else if (summary.firstPrefPct >= 90) { text = `Nearly every family who put ${school.school_name} first got a place.`; } else if (a?.oversubscribed) { text = 'More first-choice applications than places — check the school’s admission criteria (for most non-faith primaries, distance decides).'; } else { text = `${summary.firstPrefPct}% of first-choice families received an offer.`; } } return ( {text ? {text} : } ); })}
); }