fix(school, compare): ISI, not-yet-inspected and further-education states (H4)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ab25d83b9d
commit
9feb37b974
12 files changed
+143
-16
No files matched your search
@@ -14,6 +14,7 @@ import {
|
||||
summariseAdmissions,
|
||||
verdict,
|
||||
type ReportCardSummary,
|
||||
noInspectionLabel,
|
||||
} from '@/lib/compareLogic';
|
||||
import type { Benchmarks, ComparisonData, NationalAverages, School } from '@/lib/types';
|
||||
import { Cell, Chip, Measure, Section, SectionGrid, sectionStyles as s } from './sectionShared';
|
||||
@@ -91,7 +92,7 @@ export function CompareAtAGlance({
|
||||
No overall grade
|
||||
</span>
|
||||
)}
|
||||
{display.kind === 'none' && <span className={s.small}>No inspection in our dataset</span>}
|
||||
{display.kind === 'none' && <span className={s.small}>{noInspectionLabel(data[String(school.urn)]?.school_info ?? school)}</span>}
|
||||
</Cell>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
ofstedDisplay,
|
||||
rcAreaLabel,
|
||||
type OfstedDisplay,
|
||||
noInspectionLabel,
|
||||
} from '@/lib/compareLogic';
|
||||
import { gradeSourceLine } from '@/lib/ofstedStatus';
|
||||
import type { ComparisonData, OfstedCurrentGrade, OfstedInspection, School } from '@/lib/types';
|
||||
@@ -41,9 +42,11 @@ function yearsSince(iso: string | null): number | null {
|
||||
return (Date.now() - d.getTime()) / (365.25 * 24 * 3600 * 1000);
|
||||
}
|
||||
|
||||
function ResultCell({ display, current }: { display: OfstedDisplay; current: OfstedCurrentGrade | null }) {
|
||||
function ResultCell({ display, current, school }: {
|
||||
display: OfstedDisplay; current: OfstedCurrentGrade | null; school: School;
|
||||
}) {
|
||||
if (display.kind === 'none') {
|
||||
return <span className={s.small}>No inspection outcome in our dataset</span>;
|
||||
return <span className={s.small}>{noInspectionLabel(school)}</span>;
|
||||
}
|
||||
if (display.kind === 'report_card') {
|
||||
return (
|
||||
@@ -175,7 +178,7 @@ export function CompareOfsted({
|
||||
<Measure label="Result">
|
||||
{schools.map((school, i) => (
|
||||
<Cell key={school.urn} school={school} index={i}>
|
||||
<ResultCell display={displays[i]} current={data[String(school.urn)]?.ofsted?.current_grade ?? null} />
|
||||
<ResultCell display={displays[i]} current={data[String(school.urn)]?.ofsted?.current_grade ?? null} school={data[String(school.urn)]?.school_info ?? school} />
|
||||
</Cell>
|
||||
))}
|
||||
</Measure>
|
||||
@@ -213,7 +216,7 @@ export function CompareOfsted({
|
||||
schoolName={school.school_name}
|
||||
/>
|
||||
) : (
|
||||
<span className={s.small}>No inspection in our dataset</span>
|
||||
<span className={s.small}>{noInspectionLabel(data[String(school.urn)]?.school_info ?? school)}</span>
|
||||
)}
|
||||
</Cell>
|
||||
);
|
||||
@@ -228,7 +231,7 @@ export function CompareOfsted({
|
||||
{schools.map((school, i) => {
|
||||
const url =
|
||||
data[String(school.urn)]?.ofsted?.ofsted_page_url ??
|
||||
`https://reports.ofsted.gov.uk/provider/21/${school.urn}`;
|
||||
`https://reports.ofsted.gov.uk/inspection-reports/find-inspection-report/provider/ELS/${school.urn}`;
|
||||
return (
|
||||
<Cell key={school.urn} school={school} index={i}>
|
||||
{/* Short visible label to save space on mobile (the coloured
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* InspectionNotice — the school page's inspection section when there is no
|
||||
* Ofsted inspection record (audit H4): the inspectorate GIAS names (ISI), or
|
||||
* Ofsted's own "not yet inspected" when its data lists the school. Nothing
|
||||
* otherwise: no claim the data cannot support. Server component.
|
||||
*/
|
||||
|
||||
import type { School } from '@/lib/types';
|
||||
import { Section, sectionStyles as styles } from './sectionShared';
|
||||
|
||||
const OFSTED_REPORTS = 'https://reports.ofsted.gov.uk/inspection-reports/find-inspection-report/provider/ELS/';
|
||||
const ISI_REPORTS = 'https://www.isi.net/reports/';
|
||||
|
||||
export function InspectionNotice({ school }: { school: Pick<School, 'urn' | 'inspectorate' | 'ofsted_listed'> }) {
|
||||
if (school.inspectorate === 'ISI') {
|
||||
return (
|
||||
<Section id="ofsted">
|
||||
<h2 className={styles.sectionTitle}>
|
||||
Inspection
|
||||
<a href={ISI_REPORTS} target="_blank" rel="noopener noreferrer" className={styles.ofstedReportLink}
|
||||
data-umami-event="external_link_clicked" data-umami-event-target="isi">
|
||||
ISI reports ↗
|
||||
</a>
|
||||
</h2>
|
||||
<p className={styles.ofstedDisclaimer}>Inspected by the Independent Schools Inspectorate (ISI)</p>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
if (school.ofsted_listed) {
|
||||
return (
|
||||
<Section id="ofsted">
|
||||
<h2 className={styles.sectionTitle}>
|
||||
Ofsted Rating
|
||||
<a href={`${OFSTED_REPORTS}${school.urn}`} target="_blank" rel="noopener noreferrer"
|
||||
className={styles.ofstedReportLink} data-umami-event="external_link_clicked" data-umami-event-target="ofsted">
|
||||
Ofsted reports ↗
|
||||
</a>
|
||||
</h2>
|
||||
<div className={styles.ofstedHeader}>
|
||||
<span className={styles.ofstedGrade}>Not yet inspected</span>
|
||||
</div>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -12,7 +12,7 @@
|
||||
*/
|
||||
|
||||
import { ofstedDisplay } from '@/lib/compareLogic';
|
||||
import { formatOfstedDate, gradeSourceLine, latestVisitLine, showLatestVisitLine } from '@/lib/ofstedStatus';
|
||||
import { FE_FRAMEWORK, formatOfstedDate, gradeSourceLine, latestVisitLine, showLatestVisitLine } from '@/lib/ofstedStatus';
|
||||
import type { OfstedInspection } from '@/lib/types';
|
||||
import { Section, sectionStyles as styles } from './sectionShared';
|
||||
|
||||
@@ -71,6 +71,10 @@ export function OfstedSection({
|
||||
</a>
|
||||
</h2>
|
||||
|
||||
{ofsted.framework === FE_FRAMEWORK && (
|
||||
<p className={styles.ofstedDisclaimer}>{FE_FRAMEWORK}</p>
|
||||
)}
|
||||
|
||||
{isReportCard ? (
|
||||
/* ── New Report Card layout ── */
|
||||
<>
|
||||
|
||||
@@ -19,6 +19,8 @@ import type {
|
||||
import { ofstedLegacyAreas } from '@/lib/utils';
|
||||
import type { SchoolFlags } from '@/lib/schoolSections';
|
||||
import { OfstedSection } from './OfstedSection';
|
||||
import { InspectionNotice } from './InspectionNotice';
|
||||
import { hasReportCard } from '@/lib/ofstedStatus';
|
||||
import { ResultsSection } from './ResultsSection';
|
||||
import { AdmissionsSection } from './AdmissionsSection';
|
||||
import { DistanceSection } from './DistanceSection';
|
||||
@@ -54,7 +56,8 @@ export function PrimarySchoolSections({
|
||||
const primaryAvg = nationalAvg?.primary ?? {};
|
||||
const secondaryAvg = nationalAvg?.secondary ?? {};
|
||||
|
||||
const isReportCard = !!(ofsted?.report_card && Object.keys(ofsted.report_card).length > 0);
|
||||
// By date as well as area labels: an FE report card has only a safeguarding result (audit H4).
|
||||
const isReportCard = !!ofsted && hasReportCard(ofsted);
|
||||
// Report cards are dated by their own inspection (rc_inspection_date);
|
||||
// anything else by the school's latest visit, never the older inspection a
|
||||
// grade may come from.
|
||||
@@ -71,7 +74,7 @@ export function PrimarySchoolSections({
|
||||
|
||||
return (
|
||||
<>
|
||||
{ofsted && (
|
||||
{ofsted ? (
|
||||
<OfstedSection
|
||||
ofsted={ofsted}
|
||||
urn={schoolInfo.urn}
|
||||
@@ -80,7 +83,7 @@ export function PrimarySchoolSections({
|
||||
oeifAllSameGrade={oeifAllSameGrade}
|
||||
oeifAreas={oeifAreas}
|
||||
/>
|
||||
)}
|
||||
) : <InspectionNotice school={schoolInfo} />}
|
||||
|
||||
{flags.hasAnyResults && flags.latestResults && (
|
||||
<ResultsSection
|
||||
|
||||
@@ -19,6 +19,8 @@ import type {
|
||||
import { ofstedLegacyAreas } from '@/lib/utils';
|
||||
import type { SecondaryFlags } from '@/lib/schoolSections';
|
||||
import { OfstedSection } from './OfstedSection';
|
||||
import { InspectionNotice } from './InspectionNotice';
|
||||
import { hasReportCard } from '@/lib/ofstedStatus';
|
||||
import { GcseSection } from './GcseSection';
|
||||
import { DestinationsSection } from './DestinationsSection';
|
||||
import { Post16DestinationsSection } from './Post16DestinationsSection';
|
||||
@@ -60,7 +62,8 @@ export function SecondarySchoolSections({
|
||||
}: SecondarySchoolSectionsProps) {
|
||||
const secondaryAvg = nationalAvg?.secondary ?? {};
|
||||
|
||||
const isReportCard = !!(ofsted?.report_card && Object.keys(ofsted.report_card).length > 0);
|
||||
// By date as well as area labels: an FE report card has only a safeguarding result (audit H4).
|
||||
const isReportCard = !!ofsted && hasReportCard(ofsted);
|
||||
const ofstedInspectedDate = isReportCard
|
||||
? ofsted?.rc_inspection_date ?? null
|
||||
: ofsted?.latest_visit?.date ?? null;
|
||||
@@ -74,7 +77,7 @@ export function SecondarySchoolSections({
|
||||
|
||||
return (
|
||||
<div className={styles.secondaryScope}>
|
||||
{ofsted && (
|
||||
{ofsted ? (
|
||||
<OfstedSection
|
||||
ofsted={ofsted}
|
||||
urn={schoolInfo.urn}
|
||||
@@ -83,7 +86,7 @@ export function SecondarySchoolSections({
|
||||
oeifAllSameGrade={oeifAllSameGrade}
|
||||
oeifAreas={oeifAreas}
|
||||
/>
|
||||
)}
|
||||
) : <InspectionNotice school={schoolInfo} />}
|
||||
|
||||
{flags.hasResults && flags.latestResults && (
|
||||
<GcseSection
|
||||
|
||||
Reference in new issue
Block a user