fix(search): badge inspected-but-ungraded schools as "Inspected", not "Not yet inspected"
Build and Push Docker Images / Build Backend (FastAPI) (push) Successful in 13s
Build and Push Docker Images / Build Frontend (Next.js) (push) Successful in 54s
Build and Push Docker Images / Build Pipeline (Meltano + dbt + Airflow) (push) Successful in 12s
Build and Push Docker Images / Trigger Portainer Update (push) Successful in 1s
Build and Push Docker Images / Build Backend (FastAPI) (push) Successful in 13s
Build and Push Docker Images / Build Frontend (Next.js) (push) Successful in 54s
Build and Push Docker Images / Build Pipeline (Meltano + dbt + Airflow) (push) Successful in 12s
Build and Push Docker Images / Trigger Portainer Update (push) Successful in 1s
A school inspected under the OEIF framework after September 2024 has an inspection on record (ofsted_date set) but no overall_effectiveness grade, since Ofsted no longer issues an overall judgement. buildOfstedListBadge had no branch for this and fell through to "Not yet inspected", while the detail page's hero chip correctly reported it as inspected — so the same school read two contradictory ways. Add an "Inspected · YYYY" branch that fires when an inspection is on record (date or framework present) but no grade and not a Report Card, mirroring the hero chip's fallback. Genuinely un-inspected schools (all Ofsted fields null) still show "Not yet inspected". Add an .ofstedInspected badge style (neutral slate) distinct from the grey pending state, and cover both cases with tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user