Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e36125b24a | ||
|
|
a2c63b3cda | ||
|
|
b2b2cad5ac | ||
|
|
5ec4f3f7cd | ||
|
|
74bdbebd57 | ||
|
|
b31e71ac88 | ||
|
|
b05f3bebc7 | ||
|
|
ce422e6436 | ||
|
|
2ac26acf91 | ||
|
|
3e77057567 | ||
|
|
e0d5a9969e |
@@ -67,9 +67,12 @@ jobs:
|
||||
echo "Promoting $FULL_SHA (images tagged $SHORT_SHA)"
|
||||
|
||||
- name: Verify the staging E2E gate passed for this commit
|
||||
# Use the built-in Actions token (GITHUB_TOKEN is the documented name;
|
||||
# it carries repository read scope), NOT REGISTRY_TOKEN — the registry
|
||||
# token has no repo scope, so the commit-status API returns 403.
|
||||
run: |
|
||||
STATUS_JSON=$(curl -fsS \
|
||||
-H "Authorization: token ${{ secrets.REGISTRY_TOKEN }}" \
|
||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
"https://${REGISTRY}/api/v1/repos/${{ gitea.repository }}/commits/${{ steps.resolve.outputs.full }}/status")
|
||||
echo "$STATUS_JSON" | python3 -c "
|
||||
import json, sys
|
||||
|
||||
@@ -172,6 +172,7 @@ _MAIN_QUERY = text("""
|
||||
foi.ofsted_grade,
|
||||
foi.ofsted_date,
|
||||
foi.ofsted_framework,
|
||||
foi.ofsted_rc_date,
|
||||
l.local_authority_name AS local_authority,
|
||||
l.local_authority_code,
|
||||
l.address_line1 AS address1,
|
||||
@@ -256,7 +257,12 @@ _MAIN_QUERY = text("""
|
||||
-- Fall back to the ungraded-inspection grade when no graded grade exists.
|
||||
COALESCE(overall_effectiveness, ungraded_grade) AS ofsted_grade,
|
||||
inspection_date AS ofsted_date,
|
||||
framework AS ofsted_framework
|
||||
framework AS ofsted_framework,
|
||||
-- Report-card signal for list/map badges: non-null only when the
|
||||
-- latest inspection carries report-card grades. framework is the
|
||||
-- raw event grouping ("Schools - S5"), never "ReportCard", so it
|
||||
-- can't be used to detect report cards.
|
||||
rc_inspection_date AS ofsted_rc_date
|
||||
FROM marts.fact_ofsted_inspection
|
||||
ORDER BY urn, inspection_date DESC NULLS LAST
|
||||
) foi ON s.urn = foi.urn
|
||||
|
||||
@@ -550,6 +550,7 @@ SCHOOL_COLUMNS = [
|
||||
"ofsted_grade",
|
||||
"ofsted_date",
|
||||
"ofsted_framework",
|
||||
"ofsted_rc_date",
|
||||
"latitude",
|
||||
"longitude",
|
||||
]
|
||||
|
||||
@@ -80,6 +80,33 @@ test('searching by postcode returns nearby schools', async ({ page }) => {
|
||||
await expect(schoolLinks(page).first()).toBeVisible({ timeout: 15_000 });
|
||||
});
|
||||
|
||||
test('a report-card school shows a Report Card badge in search results, not its old grade', async ({ page }) => {
|
||||
// List/map badges keyed off ofsted_grade (the carried-forward legacy grade)
|
||||
// and never reached the report-card branch, so report-card schools were
|
||||
// labelled by their old grade (e.g. "Outstanding · 2021"). The list now
|
||||
// carries ofsted_rc_date and the badge treats a report card as winning.
|
||||
const RC_URN = 138690; // Barclay Primary — has a Nov-2025+ report card
|
||||
const res = await page.request.get(`/api/schools?search=Barclay%20Primary&page_size=5`);
|
||||
expect(res.ok()).toBeTruthy();
|
||||
const barclay = ((await res.json()).schools ?? []).find(
|
||||
(s: { urn: number }) => s.urn === RC_URN,
|
||||
);
|
||||
// Hard assertions, not test.skip: if the backend stops exposing
|
||||
// ofsted_rc_date for this report-card school, that IS the regression this
|
||||
// test exists to catch, so it must fail loudly rather than skip.
|
||||
expect(barclay, 'Barclay must appear in the search results').toBeTruthy();
|
||||
expect(
|
||||
barclay.ofsted_rc_date,
|
||||
'the list must expose ofsted_rc_date for a report-card school',
|
||||
).toBeTruthy();
|
||||
|
||||
await searchByName(page, 'Barclay Primary');
|
||||
// The Barclay row must be present…
|
||||
await expect(page.locator(`a[href*="${RC_URN}"]`).first()).toBeVisible({ timeout: 15_000 });
|
||||
// …badged as a Report Card, not its carried-forward "Outstanding" grade.
|
||||
await expect(page.getByText(/Report Card ·/).first()).toBeVisible();
|
||||
});
|
||||
|
||||
test('school detail page renders name and performance data', async ({ page }) => {
|
||||
await searchByName(page, 'primary');
|
||||
const firstSchool = schoolLinks(page).first();
|
||||
@@ -94,6 +121,33 @@ test('school detail page renders name and performance data', async ({ page }) =>
|
||||
await expect(page.locator('canvas:visible').first()).toBeVisible({ timeout: 15_000 });
|
||||
});
|
||||
|
||||
test('a report-card school shows its report card, dated to the report-card inspection', async ({ page }) => {
|
||||
// Detail views detected report cards via `framework`, which the API never
|
||||
// sets to "ReportCard" — so report-card schools rendered as legacy ratings
|
||||
// dated to a pre-Nov-2025 inspection. Detection now keys off the report_card
|
||||
// object and dates it with rc_inspection_date.
|
||||
const RC_URN = 138690; // Barclay Primary — has a Nov-2025+ report card
|
||||
const res = await page.request.get(`/api/schools/${RC_URN}`);
|
||||
expect(res.ok()).toBeTruthy();
|
||||
const ofsted = (await res.json()).ofsted;
|
||||
test.skip(
|
||||
!ofsted?.report_card || Object.keys(ofsted.report_card).length === 0,
|
||||
'precondition: chosen URN must currently have a report card',
|
||||
);
|
||||
const rcYear = new Date(ofsted.rc_inspection_date).getFullYear();
|
||||
const legacyYear = new Date(ofsted.inspection_date).getFullYear();
|
||||
|
||||
await page.goto(`/school/${RC_URN}`);
|
||||
const ofstedSection = page.locator('#ofsted');
|
||||
// Detection fixed: rendered as a Report Card, not a legacy "Ofsted Rating".
|
||||
await expect(ofstedSection.getByText('Ofsted Report Card')).toBeVisible({ timeout: 15_000 });
|
||||
// Dating fixed: dated to the report-card inspection, never the legacy one.
|
||||
await expect(ofstedSection.getByText(new RegExp(`Inspected .*${rcYear}`))).toBeVisible();
|
||||
if (legacyYear !== rcYear) {
|
||||
await expect(ofstedSection.getByText(new RegExp(`Inspected .*${legacyYear}`))).toHaveCount(0);
|
||||
}
|
||||
});
|
||||
|
||||
test('school with no performance data still gets a working detail page', async ({ page }) => {
|
||||
// Schools without KS2/KS4 results (special post-16 institutions, sixth-form
|
||||
// centres, PRUs) used to 500 in the API — NaN GIAS fields broke JSON
|
||||
|
||||
@@ -130,9 +130,23 @@ describe('buildOfstedListBadge', () => {
|
||||
expect(badge.cssClass).toBe('ofsted2');
|
||||
});
|
||||
|
||||
it('returns Report Card badge when framework is ReportCard', () => {
|
||||
const badge = buildOfstedListBadge({ ofsted_grade: null, ofsted_date: '2025-11-01', ofsted_framework: 'ReportCard' });
|
||||
expect(badge.label).toBe('Report Card · 2025');
|
||||
it('returns a Report Card badge when ofsted_rc_date is present', () => {
|
||||
const badge = buildOfstedListBadge({ ofsted_grade: null, ofsted_rc_date: '2026-02-03' });
|
||||
expect(badge.label).toBe('Report Card · 2026');
|
||||
expect(badge.cssClass).toBe('ofstedRc');
|
||||
});
|
||||
|
||||
it('a report card wins over a carried-forward legacy grade', () => {
|
||||
// The production bug: a report-card school (e.g. Barclay) also carries a
|
||||
// carried-forward legacy grade (ofsted_grade), which used to win and label
|
||||
// the pin "Outstanding · 2021" instead of "Report Card · 2026".
|
||||
const badge = buildOfstedListBadge({
|
||||
ofsted_grade: 1,
|
||||
ofsted_date: '2021-10-07',
|
||||
ofsted_framework: 'Schools - S5',
|
||||
ofsted_rc_date: '2026-02-03',
|
||||
});
|
||||
expect(badge.label).toBe('Report Card · 2026');
|
||||
expect(badge.cssClass).toBe('ofstedRc');
|
||||
});
|
||||
|
||||
|
||||
@@ -43,6 +43,13 @@ interface PopupBadge {
|
||||
}
|
||||
|
||||
function buildPopupBadge(school: School): PopupBadge {
|
||||
// A report card wins over any carried-forward legacy grade — its presence is
|
||||
// signalled by ofsted_rc_date (the list has no full report_card object, and
|
||||
// ofsted_framework is the raw event grouping, never "ReportCard").
|
||||
if (school.ofsted_rc_date) {
|
||||
const rcYear = new Date(school.ofsted_rc_date).getFullYear();
|
||||
return { label: `Report Card · ${rcYear}`, style: 'background:#5a3a6e;color:#fff' };
|
||||
}
|
||||
const year = school.ofsted_date ? new Date(school.ofsted_date).getFullYear() : null;
|
||||
const yearStr = year ? ` · ${year}` : '';
|
||||
if (school.ofsted_grade) {
|
||||
@@ -55,9 +62,6 @@ function buildPopupBadge(school: School): PopupBadge {
|
||||
};
|
||||
return { label: `${labels[school.ofsted_grade]}${yearStr}`, style: colours[school.ofsted_grade] };
|
||||
}
|
||||
if (school.ofsted_framework === 'ReportCard') {
|
||||
return { label: `Report Card${yearStr}`, style: 'background:#5a3a6e;color:#fff' };
|
||||
}
|
||||
return { label: 'Not yet inspected', style: 'background:#e0e0e0;color:#666' };
|
||||
}
|
||||
|
||||
|
||||
@@ -269,9 +269,24 @@ export function SchoolDetailView({
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [navItems.map(n => n.id).join(',')]);
|
||||
|
||||
// A report card is identified by the presence of report-card area
|
||||
// judgements, NOT by `framework` — the API sets `framework` to the raw
|
||||
// event grouping (e.g. "Schools - S5") even for report-card schools, so
|
||||
// the old `framework === 'ReportCard'` test never matched and report cards
|
||||
// were rendered as legacy ratings dated to a pre-Nov-2025 inspection.
|
||||
const isReportCard = !!(
|
||||
ofsted?.report_card && Object.keys(ofsted.report_card).length > 0
|
||||
);
|
||||
// A report card is dated by its own inspection (rc_inspection_date); the
|
||||
// legacy inspection_date belongs to an older inspection and must never
|
||||
// date a report card (report cards exist only from Nov 2025).
|
||||
const ofstedInspectedDate = isReportCard
|
||||
? ofsted?.rc_inspection_date ?? null
|
||||
: ofsted?.inspection_date ?? null;
|
||||
|
||||
// ── Ofsted: detect if all OEIF sub-grades match the overall ───────────
|
||||
const oeifAllSameGrade = (() => {
|
||||
if (!ofsted || ofsted.framework === 'ReportCard') return false;
|
||||
if (!ofsted || isReportCard) return false;
|
||||
const subs = [
|
||||
ofsted.quality_of_education,
|
||||
ofsted.behaviour_attitudes,
|
||||
@@ -507,10 +522,10 @@ export function SchoolDetailView({
|
||||
{ofsted && (
|
||||
<section id="ofsted" className={styles.card}>
|
||||
<h2 className={styles.sectionTitle}>
|
||||
{ofsted.framework === 'ReportCard' ? 'Ofsted Report Card' : 'Ofsted Rating'}
|
||||
{ofsted.inspection_date && (
|
||||
{isReportCard ? 'Ofsted Report Card' : 'Ofsted Rating'}
|
||||
{ofstedInspectedDate && (
|
||||
<span className={styles.ofstedDate}>
|
||||
Inspected {new Date(ofsted.inspection_date).toLocaleDateString('en-GB', { day: 'numeric', month: 'long', year: 'numeric' })}
|
||||
Inspected {new Date(ofstedInspectedDate).toLocaleDateString('en-GB', { day: 'numeric', month: 'long', year: 'numeric' })}
|
||||
</span>
|
||||
)}
|
||||
<a
|
||||
@@ -525,7 +540,7 @@ export function SchoolDetailView({
|
||||
</a>
|
||||
</h2>
|
||||
|
||||
{ofsted.framework === 'ReportCard' ? (
|
||||
{isReportCard ? (
|
||||
/* ── New Report Card layout ── */
|
||||
<>
|
||||
<p className={styles.ofstedDisclaimer}>
|
||||
@@ -607,8 +622,8 @@ export function SchoolDetailView({
|
||||
</h2>
|
||||
<p className={styles.sectionSubtitle}>
|
||||
{isSecondary
|
||||
? 'GCSE results for Year 11 pupils. National averages shown for comparison.'
|
||||
: 'End-of-primary-school tests taken by Year 6 pupils. National averages shown for comparison.'}
|
||||
? 'GCSE results for Year 11 pupils. England averages shown for comparison.'
|
||||
: 'End-of-primary-school tests taken by Year 6 pupils. England averages shown for comparison.'}
|
||||
</p>
|
||||
|
||||
{/* ── Primary / KS2 content ── */}
|
||||
@@ -633,7 +648,7 @@ export function SchoolDetailView({
|
||||
)}
|
||||
</div>
|
||||
{primaryAvg.rwm_expected_pct != null && (
|
||||
<div className={styles.heroStatHint}>National avg: {primaryAvg.rwm_expected_pct.toFixed(0)}%</div>
|
||||
<div className={styles.heroStatHint}>England avg: {primaryAvg.rwm_expected_pct.toFixed(0)}%</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
@@ -655,7 +670,7 @@ export function SchoolDetailView({
|
||||
)}
|
||||
</div>
|
||||
{primaryAvg.rwm_high_pct != null && (
|
||||
<div className={styles.heroStatHint}>National avg: {primaryAvg.rwm_high_pct.toFixed(0)}%</div>
|
||||
<div className={styles.heroStatHint}>England avg: {primaryAvg.rwm_high_pct.toFixed(0)}%</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
@@ -761,7 +776,7 @@ export function SchoolDetailView({
|
||||
</div>
|
||||
<div className={styles.metricValue}>{latestResults.attainment_8_score.toFixed(1)}</div>
|
||||
{secondaryAvg.attainment_8_score != null && (
|
||||
<div className={styles.metricHint}>National avg: {secondaryAvg.attainment_8_score.toFixed(1)}</div>
|
||||
<div className={styles.metricHint}>England avg: {secondaryAvg.attainment_8_score.toFixed(1)}</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
@@ -785,7 +800,7 @@ export function SchoolDetailView({
|
||||
</div>
|
||||
<div className={styles.metricValue}>{formatPercentage(latestResults.english_maths_standard_pass_pct)}</div>
|
||||
{secondaryAvg.english_maths_standard_pass_pct != null && (
|
||||
<div className={styles.metricHint}>National avg: {secondaryAvg.english_maths_standard_pass_pct.toFixed(0)}%</div>
|
||||
<div className={styles.metricHint}>England avg: {secondaryAvg.english_maths_standard_pass_pct.toFixed(0)}%</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
@@ -797,7 +812,7 @@ export function SchoolDetailView({
|
||||
</div>
|
||||
<div className={styles.metricValue}>{formatPercentage(latestResults.english_maths_strong_pass_pct)}</div>
|
||||
{secondaryAvg.english_maths_strong_pass_pct != null && (
|
||||
<div className={styles.metricHint}>National avg: {secondaryAvg.english_maths_strong_pass_pct.toFixed(0)}%</div>
|
||||
<div className={styles.metricHint}>England avg: {secondaryAvg.english_maths_strong_pass_pct.toFixed(0)}%</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
@@ -953,7 +968,7 @@ export function SchoolDetailView({
|
||||
)}
|
||||
</div>
|
||||
{primaryAvg.eal_pct != null && (
|
||||
<div className={styles.heroStatHint}>National avg: {primaryAvg.eal_pct.toFixed(0)}%</div>
|
||||
<div className={styles.heroStatHint}>England avg: {primaryAvg.eal_pct.toFixed(0)}%</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
@@ -970,7 +985,7 @@ export function SchoolDetailView({
|
||||
)}
|
||||
</div>
|
||||
{primaryAvg.sen_support_pct != null && (
|
||||
<div className={styles.heroStatHint}>National avg: {primaryAvg.sen_support_pct.toFixed(0)}%</div>
|
||||
<div className={styles.heroStatHint}>England avg: {primaryAvg.sen_support_pct.toFixed(0)}%</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
@@ -1142,7 +1157,7 @@ export function SchoolDetailView({
|
||||
</div>
|
||||
<div className={styles.metricValue}>{formatPercentage(absenceData.overall_absence_rate)}</div>
|
||||
{primaryAvg.overall_absence_pct != null && (
|
||||
<div className={styles.metricHint}>National avg: ~{primaryAvg.overall_absence_pct.toFixed(1)}%</div>
|
||||
<div className={styles.metricHint}>England avg: ~{primaryAvg.overall_absence_pct.toFixed(1)}%</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
@@ -1154,7 +1169,7 @@ export function SchoolDetailView({
|
||||
</div>
|
||||
<div className={styles.metricValue}>{formatPercentage(absenceData.persistent_absence_rate)}</div>
|
||||
{primaryAvg.persistent_absence_pct != null && (
|
||||
<div className={styles.metricHint}>National avg: ~{primaryAvg.persistent_absence_pct.toFixed(0)}%</div>
|
||||
<div className={styles.metricHint}>England avg: ~{primaryAvg.persistent_absence_pct.toFixed(0)}%</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -186,9 +186,23 @@ export function SecondarySchoolDetailView({
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [navItems.map(n => n.id).join(',')]);
|
||||
|
||||
// A report card is identified by the presence of report-card area
|
||||
// judgements, NOT by `framework` — the API sets `framework` to the raw
|
||||
// event grouping (e.g. "Schools - S5") even for report-card schools, so
|
||||
// the old `framework === 'ReportCard'` test never matched and report cards
|
||||
// were rendered as legacy ratings dated to a pre-Nov-2025 inspection.
|
||||
const isReportCard = !!(
|
||||
ofsted?.report_card && Object.keys(ofsted.report_card).length > 0
|
||||
);
|
||||
// Report cards are dated by their own inspection (rc_inspection_date), never
|
||||
// the legacy inspection_date (report cards exist only from Nov 2025).
|
||||
const ofstedInspectedDate = isReportCard
|
||||
? ofsted?.rc_inspection_date ?? null
|
||||
: ofsted?.inspection_date ?? null;
|
||||
|
||||
// ── Ofsted: detect if all OEIF sub-grades match the overall ───────────
|
||||
const oeifAllSameGrade = (() => {
|
||||
if (!ofsted || ofsted.framework === 'ReportCard') return false;
|
||||
if (!ofsted || isReportCard) return false;
|
||||
const subs = [
|
||||
ofsted.quality_of_education,
|
||||
ofsted.behaviour_attitudes,
|
||||
@@ -332,10 +346,10 @@ export function SecondarySchoolDetailView({
|
||||
{ofsted && (
|
||||
<section id="ofsted" className={styles.card}>
|
||||
<h2 className={styles.sectionTitle}>
|
||||
{ofsted.framework === 'ReportCard' ? 'Ofsted Report Card' : 'Ofsted Rating'}
|
||||
{ofsted.inspection_date && (
|
||||
{isReportCard ? 'Ofsted Report Card' : 'Ofsted Rating'}
|
||||
{ofstedInspectedDate && (
|
||||
<span className={styles.ofstedDate}>
|
||||
{' '}Inspected {new Date(ofsted.inspection_date).toLocaleDateString('en-GB', { day: 'numeric', month: 'long', year: 'numeric' })}
|
||||
{' '}Inspected {new Date(ofstedInspectedDate).toLocaleDateString('en-GB', { day: 'numeric', month: 'long', year: 'numeric' })}
|
||||
</span>
|
||||
)}
|
||||
<a
|
||||
@@ -349,7 +363,7 @@ export function SecondarySchoolDetailView({
|
||||
Ofsted reports ↗
|
||||
</a>
|
||||
</h2>
|
||||
{ofsted.framework === 'ReportCard' ? (
|
||||
{isReportCard ? (
|
||||
<>
|
||||
<p className={styles.ofstedDisclaimer}>
|
||||
From November 2025, Ofsted replaced single overall grades with Report Cards rating schools across several areas.
|
||||
@@ -449,7 +463,7 @@ export function SecondarySchoolDetailView({
|
||||
GCSE Results ({formatAcademicYear(latestResults.year)})
|
||||
</h2>
|
||||
<p className={styles.sectionSubtitle}>
|
||||
GCSE results for Year 11 pupils. National averages shown for comparison.
|
||||
GCSE results for Year 11 pupils. England averages shown for comparison.
|
||||
</p>
|
||||
|
||||
{p8Suspended && (
|
||||
@@ -478,7 +492,7 @@ export function SecondarySchoolDetailView({
|
||||
)}
|
||||
</div>
|
||||
{secondaryAvg.attainment_8_score != null && (
|
||||
<div className={styles.heroStatHint}>National avg: {secondaryAvg.attainment_8_score.toFixed(1)}</div>
|
||||
<div className={styles.heroStatHint}>England avg: {secondaryAvg.attainment_8_score.toFixed(1)}</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
@@ -518,7 +532,7 @@ export function SecondarySchoolDetailView({
|
||||
)}
|
||||
</div>
|
||||
{secondaryAvg.english_maths_strong_pass_pct != null && (
|
||||
<div className={styles.heroStatHint}>National avg: {secondaryAvg.english_maths_strong_pass_pct.toFixed(0)}%</div>
|
||||
<div className={styles.heroStatHint}>England avg: {secondaryAvg.english_maths_strong_pass_pct.toFixed(0)}%</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
@@ -540,7 +554,7 @@ export function SecondarySchoolDetailView({
|
||||
)}
|
||||
</div>
|
||||
{secondaryAvg.english_maths_standard_pass_pct != null && (
|
||||
<div className={styles.heroStatHint}>National avg: {secondaryAvg.english_maths_standard_pass_pct.toFixed(0)}%</div>
|
||||
<div className={styles.heroStatHint}>England avg: {secondaryAvg.english_maths_standard_pass_pct.toFixed(0)}%</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -239,8 +239,17 @@ export function CompareOfsted({
|
||||
`https://reports.ofsted.gov.uk/provider/21/${school.urn}`;
|
||||
return (
|
||||
<Cell key={school.urn} school={school} index={i}>
|
||||
<a className={s.link} href={url} target="_blank" rel="noopener noreferrer">
|
||||
{school.school_name}'s Ofsted page →
|
||||
{/* Short visible label to save space on mobile (the coloured
|
||||
school name already leads the row); the full name stays in
|
||||
aria-label so screen readers can tell the links apart. */}
|
||||
<a
|
||||
className={s.link}
|
||||
href={url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
aria-label={`${school.school_name}'s Ofsted page`}
|
||||
>
|
||||
Ofsted page →
|
||||
</a>
|
||||
</Cell>
|
||||
);
|
||||
|
||||
@@ -68,6 +68,9 @@ export interface School {
|
||||
|
||||
// Ofsted (for list view — summary only)
|
||||
ofsted_grade?: 1 | 2 | 3 | 4 | null;
|
||||
/** Report-card inspection date (Nov 2025+); non-null identifies a report
|
||||
* card in the list/map, where the full report_card object isn't available. */
|
||||
ofsted_rc_date?: string | null;
|
||||
ofsted_date?: string | null;
|
||||
ofsted_framework?: string | null;
|
||||
}
|
||||
|
||||
+14
-6
@@ -691,9 +691,12 @@ export interface OfstedListBadge {
|
||||
|
||||
/**
|
||||
* Build the Ofsted badge for a school card in the list/map view.
|
||||
* Three states:
|
||||
* States, in priority order:
|
||||
* - Report Card school (ofsted_rc_date set): "Report Card · YYYY" in purple.
|
||||
* Checked FIRST so it wins over any carried-forward legacy grade — the
|
||||
* list has no full report_card object, and ofsted_framework is the raw
|
||||
* event grouping ("Schools - S5"), never "ReportCard".
|
||||
* - OEIF school (ofsted_grade set): grade word + year, colour-keyed
|
||||
* - ReportCard school (ofsted_framework === 'ReportCard'): "Report Card · YYYY" in purple
|
||||
* - Inspected without an overall grade (OEIF post-Sept-2024, where Ofsted no
|
||||
* longer issues an overall judgement): "Inspected · YYYY" — mirrors the
|
||||
* detail page's hero chip so a school never reads as both inspected and
|
||||
@@ -704,7 +707,16 @@ export function buildOfstedListBadge(school: {
|
||||
ofsted_grade?: 1 | 2 | 3 | 4 | null;
|
||||
ofsted_date?: string | null;
|
||||
ofsted_framework?: string | null;
|
||||
ofsted_rc_date?: string | null;
|
||||
}): OfstedListBadge {
|
||||
// A report card wins over any carried-forward legacy grade — signalled by
|
||||
// ofsted_rc_date. ofsted_framework is the raw event grouping ("Schools -
|
||||
// S5"), never "ReportCard", so it can't detect report cards.
|
||||
if (school.ofsted_rc_date) {
|
||||
const rcYear = new Date(school.ofsted_rc_date).getFullYear();
|
||||
return { label: `Report Card · ${rcYear}`, cssClass: 'ofstedRc' };
|
||||
}
|
||||
|
||||
const year = school.ofsted_date
|
||||
? new Date(school.ofsted_date).getFullYear()
|
||||
: null;
|
||||
@@ -723,10 +735,6 @@ export function buildOfstedListBadge(school: {
|
||||
};
|
||||
}
|
||||
|
||||
if (school.ofsted_framework === 'ReportCard') {
|
||||
return { label: `Report Card${yearStr}`, cssClass: 'ofstedRc' };
|
||||
}
|
||||
|
||||
// An inspection is on record (date or framework present) but carries no
|
||||
// overall grade — a post-Sept-2024 OEIF inspection. Distinct from a school
|
||||
// that has genuinely never been inspected.
|
||||
|
||||
Reference in New Issue
Block a user