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 } from './types';
|
||||
import { hasNurseryClasses, hasReligiousCharacter, singleSexLabel } from './utils';
|
||||
import { hasNurseryClasses, hasReligiousCharacter, isSelective, singleSexLabel } from './utils';
|
||||
|
||||
/** The search filter's type groups (backend/school_groups.py), without its
|
||||
* parenthesised notes: fees have a flag of their own. */
|
||||
@@ -54,7 +54,7 @@ export function schoolFlags(school: FlagFields): SchoolFlag[] {
|
||||
const phase = school.phase?.trim().toLowerCase();
|
||||
|
||||
if (school.type_group === 'independent') condition('Fee-paying');
|
||||
if (school.admissions_policy?.trim().toLowerCase() === 'selective') condition('Selective');
|
||||
if (isSelective(school.admissions_policy)) condition('Selective');
|
||||
const singleSex = singleSexLabel(school.gender);
|
||||
if (singleSex) condition(singleSex);
|
||||
if (hasReligiousCharacter(school.religious_denomination)) {
|
||||
|
||||
+13
-3
@@ -923,12 +923,22 @@ export function isSpecialSchool(school: { school_type?: string | null }): boolea
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether GIAS records a religious character. "None" and "Does not apply" are
|
||||
* the register's two ways of saying it has none, and neither is a faith.
|
||||
* Whether GIAS records a religious character. "None", "Does not apply" and
|
||||
* "Not applicable" are the register's ways of saying it has none; the place
|
||||
* table (PlaceView's NO_FAITH) reads the same three.
|
||||
*/
|
||||
export function hasReligiousCharacter(value: string | null | undefined): boolean {
|
||||
const v = value?.trim().toLowerCase() ?? '';
|
||||
return v !== '' && v !== 'none' && v !== 'does not apply';
|
||||
return v !== '' && v !== 'none' && v !== 'does not apply' && v !== 'not applicable';
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether GIAS records the school as selective. Exact: "Non-selective"
|
||||
* contains "selective", so a substring test read every comprehensive as
|
||||
* selective. (The register files a partly selective school as non-selective.)
|
||||
*/
|
||||
export function isSelective(admissionsPolicy: string | null | undefined): boolean {
|
||||
return admissionsPolicy?.trim().toLowerCase() === 'selective';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user