fix(compare): expert should-fixes S1-S4, S6 (S5/S7 closed by verification) #55

Merged
tudor merged 2 commits from fix/expert-signoff-shouldfixes into main 2026-07-17 17:53:16 +00:00
Showing only changes of commit 200a97d0b9 - Show all commits
@@ -150,13 +150,15 @@ export function CompareAcademics({
});
// DfE stopped publishing Progress 8 from 2024/25: those GCSE year groups
// sat no KS2 tests (COVID), so there is no baseline to measure progress
// from. A bare "No data" reads as a gap on our side — say why.
const latestYear = urns.reduce((max, urn) => {
// from. A bare "No data" reads as a gap on our side — say why. Judged
// PER SCHOOL on its own latest data year: a school whose data simply
// stops earlier (an unrelated gap) must not borrow the COVID explanation
// from a neighbour that does have 2024/25 data.
const p8NotPublished = urns.map((urn) => {
const rows = data[String(urn)]?.yearly_data ?? [];
const y = rows.length ? Math.trunc(rows[rows.length - 1].year) : 0;
return Math.max(max, y);
}, 0);
const p8NotPublished = latestYear >= 202425;
return y >= 202425;
});
const grade5 = latestValues(data, urns, 'english_maths_strong_pass_pct');
const ebacc = latestValues(data, urns, 'ebacc_entry_pct');
const att8Anchor = nationalAverages?.secondary?.attainment_8_score;
@@ -198,7 +200,7 @@ export function CompareAcademics({
>
{banding[i]}
</Chip>
) : p8NotPublished ? (
) : p8NotPublished[i] ? (
<span className={s.small}>
Not published this GCSE year group sat no KS2 tests (COVID), so DfE has no
baseline to measure progress from
@@ -234,15 +236,21 @@ export function CompareAcademics({
const disadvantagedAnchor = benchmarks?.primary?.disadvantaged_rwm_expected_pct ?? null;
// Cohort size behind the disadvantaged figure (spec §8.5): these are small
// groups where single pupils move the percentage — show roughly how many
// pupils the figure rests on.
const eligible = latestValues(data, urns, 'eligible_pupils');
const disadvantagedShare = latestValues(data, urns, 'disadvantaged_pct');
const cohorts = urns.map((_, i) => {
const n = eligible[i];
const share = disadvantagedShare[i];
if (n == null || share == null) return null;
const cohort = Math.round((n * share) / 100);
return cohort > 0 ? cohort : null;
// pupils the figure rests on. Taken from the SAME yearly row that supplies
// the displayed percentage: resolving eligible_pupils and the
// disadvantaged share independently could mix years and misstate the
// cohort behind the figure.
const cohorts = urns.map((urn) => {
const rows = data[String(urn)]?.yearly_data ?? [];
for (let i = rows.length - 1; i >= 0; i--) {
const row = rows[i];
if (row.rwm_expected_disadvantaged_pct != null) {
if (row.eligible_pupils == null || row.disadvantaged_pct == null) return null;
const cohort = Math.round((row.eligible_pupils * row.disadvantaged_pct) / 100);
return cohort > 0 ? cohort : null;
}
}
return null;
});
return (