diff --git a/nextjs-app/__tests__/lib/utils.test.ts b/nextjs-app/__tests__/lib/utils.test.ts index 44afec9..ddc1a0c 100644 --- a/nextjs-app/__tests__/lib/utils.test.ts +++ b/nextjs-app/__tests__/lib/utils.test.ts @@ -129,7 +129,21 @@ describe('buildOfstedListBadge', () => { expect(badge.cssClass).toBe('ofstedRc'); }); - it('returns pending badge when no grade and no ReportCard framework', () => { + it('returns an "Inspected" badge for an OEIF inspection with no overall grade (post-Sept-2024)', () => { + // Inspected after Sept 2024: inspection on record (date + framework) but + // Ofsted no longer issues an overall grade. Must NOT read as "Not yet inspected". + const badge = buildOfstedListBadge({ ofsted_grade: null, ofsted_date: '2024-11-01', ofsted_framework: 'OEIF' }); + expect(badge.label).toBe('Inspected · 2024'); + expect(badge.cssClass).toBe('ofstedInspected'); + }); + + it('returns an "Inspected" badge without a year when the grade is missing and date is absent but a record exists', () => { + const badge = buildOfstedListBadge({ ofsted_grade: null, ofsted_date: null, ofsted_framework: 'OEIF' }); + expect(badge.label).toBe('Inspected'); + expect(badge.cssClass).toBe('ofstedInspected'); + }); + + it('returns pending badge when no grade and no inspection on record', () => { const badge = buildOfstedListBadge({ ofsted_grade: null, ofsted_date: null, ofsted_framework: null }); expect(badge.label).toBe('Not yet inspected'); expect(badge.cssClass).toBe('ofstedPending'); diff --git a/nextjs-app/components/SchoolRow.module.css b/nextjs-app/components/SchoolRow.module.css index c1f7659..ffb3830 100644 --- a/nextjs-app/components/SchoolRow.module.css +++ b/nextjs-app/components/SchoolRow.module.css @@ -202,6 +202,9 @@ /* ── Ofsted badge variants ──────────────────────────────────────────────── */ /* ofsted1–4 already defined above; these cover the two new framework states */ .ofstedRc { background: #5a3a6e; color: #fff; } +/* Inspected but with no overall grade (OEIF post-Sept-2024) — neutral slate, + distinct from the grey "Not yet inspected" pending state. */ +.ofstedInspected { background: #e6ecf2; color: #45586b; } .ofstedPending { background: #e0e0e0; color: #666; } /* ── vs-national delta line (under RWM metric) ──────────────────────────── */ diff --git a/nextjs-app/components/SecondarySchoolRow.module.css b/nextjs-app/components/SecondarySchoolRow.module.css index 65d56bd..001e3b6 100644 --- a/nextjs-app/components/SecondarySchoolRow.module.css +++ b/nextjs-app/components/SecondarySchoolRow.module.css @@ -203,6 +203,9 @@ /* ── Ofsted badge variants ──────────────────────────────────────────────── */ .ofstedRc { background: #5a3a6e; color: #fff; } +/* Inspected but with no overall grade (OEIF post-Sept-2024) — neutral slate, + distinct from the grey "Not yet inspected" pending state. */ +.ofstedInspected { background: #e6ecf2; color: #45586b; } .ofstedPending { background: #e0e0e0; color: #666; } /* ── Right actions column ────────────────────────────── */ diff --git a/nextjs-app/lib/utils.ts b/nextjs-app/lib/utils.ts index 8a65f9a..2f47c54 100644 --- a/nextjs-app/lib/utils.ts +++ b/nextjs-app/lib/utils.ts @@ -592,7 +592,11 @@ export interface OfstedListBadge { * Three states: * - OEIF school (ofsted_grade set): grade word + year, colour-keyed * - ReportCard school (ofsted_framework === 'ReportCard'): "Report Card · YYYY" in purple - * - No inspection: "Not yet inspected" in grey + * - 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 + * "Not yet inspected" + * - No inspection on record: "Not yet inspected" in grey */ export function buildOfstedListBadge(school: { ofsted_grade?: 1 | 2 | 3 | 4 | null; @@ -621,5 +625,12 @@ export function buildOfstedListBadge(school: { 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. + if (school.ofsted_date != null || school.ofsted_framework != null) { + return { label: `Inspected${yearStr}`, cssClass: 'ofstedInspected' }; + } + return { label: 'Not yet inspected', cssClass: 'ofstedPending' }; }