fix(compare): date report cards with their own inspection date, never the legacy one
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0146VHeLAWjDVE2B5uU67jCB
This commit is contained in:
@@ -180,10 +180,18 @@ export function CompareOfsted({
|
||||
<Measure label="Inspected">
|
||||
{schools.map((school, i) => {
|
||||
const ofsted = data[String(school.urn)]?.ofsted;
|
||||
const age = yearsSince(ofsted?.inspection_date ?? null);
|
||||
// A report card is dated by its OWN inspection date. The legacy
|
||||
// inspection_date belongs to an older inspection and must never
|
||||
// be shown against a report card (report cards exist only from
|
||||
// Nov 2025).
|
||||
const dateIso =
|
||||
displays[i].kind === 'report_card'
|
||||
? ofsted?.rc_inspection_date ?? null
|
||||
: ofsted?.inspection_date ?? null;
|
||||
const age = yearsSince(dateIso);
|
||||
return (
|
||||
<Cell key={school.urn} school={school} index={i}>
|
||||
{formatInspectionDate(ofsted?.inspection_date ?? null)}{' '}
|
||||
{formatInspectionDate(dateIso)}{' '}
|
||||
{age != null && age > 4 && <Chip tone="neutral">4+ years ago</Chip>}
|
||||
</Cell>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user