feat(ui): sixth-form badge, note and filter labels use GIAS flag
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,46 @@
|
|||||||
|
/**
|
||||||
|
* SecondarySchoolRow — sixth-form tag must come from the GIAS
|
||||||
|
* has_sixth_form flag, not the age_range-contains-"18" heuristic.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import '@testing-library/jest-dom';
|
||||||
|
import { render, screen } from '@testing-library/react';
|
||||||
|
import { SecondarySchoolRow } from '@/components/SecondarySchoolRow';
|
||||||
|
import type { School } from '@/lib/types';
|
||||||
|
|
||||||
|
const base = {
|
||||||
|
urn: 100002,
|
||||||
|
school_name: 'Beta Sixth Form College',
|
||||||
|
local_authority: 'Testshire',
|
||||||
|
school_type: 'Academy',
|
||||||
|
phase: 'Secondary',
|
||||||
|
gender: 'Mixed',
|
||||||
|
attainment_8_score: 50.0,
|
||||||
|
} as unknown as School;
|
||||||
|
|
||||||
|
describe('SecondarySchoolRow sixth-form tag', () => {
|
||||||
|
it('shows the tag for a 16-19 college with the GIAS flag set', () => {
|
||||||
|
render(
|
||||||
|
<SecondarySchoolRow
|
||||||
|
school={{ ...base, age_range: '16-19', has_sixth_form: true }}
|
||||||
|
/>,
|
||||||
|
);
|
||||||
|
expect(screen.getByText('Sixth form')).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('hides the tag for an 11-18 school without a registered sixth form', () => {
|
||||||
|
render(
|
||||||
|
<SecondarySchoolRow
|
||||||
|
school={{ ...base, age_range: '11-18', has_sixth_form: false }}
|
||||||
|
/>,
|
||||||
|
);
|
||||||
|
expect(screen.queryByText('Sixth form')).not.toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('hides the tag when the flag is missing (pipeline not yet re-run)', () => {
|
||||||
|
render(
|
||||||
|
<SecondarySchoolRow school={{ ...base, age_range: '11-18' }} />,
|
||||||
|
);
|
||||||
|
expect(screen.queryByText('Sixth form')).not.toBeInTheDocument();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -368,8 +368,8 @@ export function FilterBar({
|
|||||||
disabled={isPending}
|
disabled={isPending}
|
||||||
>
|
>
|
||||||
<option value="">With or without sixth form</option>
|
<option value="">With or without sixth form</option>
|
||||||
<option value="yes">With sixth form (11-18)</option>
|
<option value="yes">With sixth form</option>
|
||||||
<option value="no">Without sixth form (11-16)</option>
|
<option value="no">Without sixth form</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
{admissionsPolicyOptions.length > 0 && (
|
{admissionsPolicyOptions.length > 0 && (
|
||||||
|
|||||||
@@ -98,7 +98,8 @@ export function SecondarySchoolDetailView({
|
|||||||
|
|
||||||
const secondaryAvg = nationalAvg?.secondary ?? {};
|
const secondaryAvg = nationalAvg?.secondary ?? {};
|
||||||
|
|
||||||
const hasSixthForm = schoolInfo.age_range?.includes('18') ?? false;
|
// GIAS OfficialSixthForm flag; missing (pipeline not yet re-run) => false.
|
||||||
|
const hasSixthForm = schoolInfo.has_sixth_form ?? false;
|
||||||
const hasFinance = finance != null && finance.per_pupil_spend != null;
|
const hasFinance = finance != null && finance.per_pupil_spend != null;
|
||||||
const hasDeprivation = deprivation != null && deprivation.idaci_decile != null;
|
const hasDeprivation = deprivation != null && deprivation.idaci_decile != null;
|
||||||
const hasLocation = schoolInfo.latitude != null && schoolInfo.longitude != null;
|
const hasLocation = schoolInfo.latitude != null && schoolInfo.longitude != null;
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ function detectAdmissionsTag(school: School): string | null {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function hasSixthForm(school: School): boolean {
|
function hasSixthForm(school: School): boolean {
|
||||||
return school.age_range?.includes('18') ?? false;
|
// GIAS OfficialSixthForm flag; missing (pipeline not yet re-run) => false.
|
||||||
|
return school.has_sixth_form ?? false;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SecondarySchoolRowProps {
|
interface SecondarySchoolRowProps {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ export interface School {
|
|||||||
school_type_code: string | null;
|
school_type_code: string | null;
|
||||||
religious_denomination: string | null;
|
religious_denomination: string | null;
|
||||||
age_range: string | null;
|
age_range: string | null;
|
||||||
|
has_sixth_form?: boolean | null;
|
||||||
|
|
||||||
// Address
|
// Address
|
||||||
address1: string | null;
|
address1: string | null;
|
||||||
|
|||||||
Reference in New Issue
Block a user