fix(school): send the school page its admissions policy, and read it exactly
The header's Selective flag read school_info.admissions_policy, which the detail endpoint never sent, so no school page could flag Selective while its search row did (staging E2E: The Grammar School at Leeds). The detail payload now carries it, and a contract test checks it carries every field the header's flags read. Sending it would have switched on two older copies of the tag logic #176 fixed in the rows. The Admissions section and the cut-off note both tested includes('selective'), so every non-selective secondary would have read "entry is by selective examination". The section also counted "None" as a faith: Burntwood reads "a faith-based admissions priority (None)" today. All of them now share isSelective() and hasReligiousCharacter(), which also treats "Not applicable" as no faith, as the place table already does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
392ec29fdb
commit
ef4a2ccccb
9 files changed
+144
-13
No files matched your search
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
import type { School, SchoolAdmissions, SchoolAdmissionDistance } from '@/lib/types';
|
||||
import { formatPercentage } from '@/lib/utils';
|
||||
import { formatPercentage, hasReligiousCharacter, isSelective } from '@/lib/utils';
|
||||
import { Section, sectionStyles as styles } from './sectionShared';
|
||||
import {
|
||||
describeCutoff, describeCutoffAbsence,
|
||||
@@ -33,10 +33,8 @@ export function SecondaryAdmissionsSection({
|
||||
const featureOn = admissionDistance !== undefined;
|
||||
// Moved with this section from SecondarySchoolDetailView, its only consumer.
|
||||
const admissionsTag = (() => {
|
||||
const policy = schoolInfo.admissions_policy?.toLowerCase() ?? '';
|
||||
if (policy.includes('selective')) return 'Selective';
|
||||
const denom = schoolInfo.religious_denomination ?? '';
|
||||
if (denom && denom !== 'Does not apply') return 'Faith priority';
|
||||
if (isSelective(schoolInfo.admissions_policy)) return 'Selective';
|
||||
if (hasReligiousCharacter(schoolInfo.religious_denomination)) return 'Faith priority';
|
||||
return null;
|
||||
})();
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import type { SchoolAdmissionDistance } from '@/lib/types';
|
||||
import { formatCutoffDistance, formatMiles, formatEntryYear } from '@/lib/utils';
|
||||
import { formatCutoffDistance, formatMiles, formatEntryYear, isSelective } from '@/lib/utils';
|
||||
|
||||
export interface CutoffDisplay {
|
||||
/** Headline figure, e.g. "0.31 miles". */
|
||||
@@ -193,8 +193,7 @@ export function describeCutoffAbsence({
|
||||
admissionsPolicy,
|
||||
admissionsHistory = [],
|
||||
}: AbsenceInput): string {
|
||||
const policy = (admissionsPolicy ?? '').toLowerCase();
|
||||
if (policy.includes('selective')) {
|
||||
if (isSelective(admissionsPolicy)) {
|
||||
return 'Places at this school are ranked by the entrance test rather than by '
|
||||
+ 'distance, so no cut-off distance applies.';
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user