From 109fa14ccb90425096df8b01c06335959243baf0 Mon Sep 17 00:00:00 2001 From: Tudor Sitaru Date: Thu, 9 Apr 2026 16:04:41 +0100 Subject: [PATCH] fix(secondary): use GIAS total_pupils for school roll, not KS4 exam cohort latestResults.total_pupils in KS4 data is the Year 11 exam cohort (~1/7 of the school), not the full school roll. Prefer schoolInfo.total_pupils (sourced from GIAS NumberOfPupils) which is the statutory census headcount. Co-Authored-By: Claude Sonnet 4.6 --- nextjs-app/components/SecondarySchoolDetailView.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nextjs-app/components/SecondarySchoolDetailView.tsx b/nextjs-app/components/SecondarySchoolDetailView.tsx index 00e124a..624b128 100644 --- a/nextjs-app/components/SecondarySchoolDetailView.tsx +++ b/nextjs-app/components/SecondarySchoolDetailView.tsx @@ -215,9 +215,9 @@ export function SecondarySchoolDetailView({ )} - {latestResults?.total_pupils != null && ( + {(schoolInfo.total_pupils != null || latestResults?.total_pupils != null) && ( - Pupils: {latestResults.total_pupils.toLocaleString()} + Pupils: {(schoolInfo.total_pupils ?? latestResults!.total_pupils!).toLocaleString()} {schoolInfo.capacity != null && ` (capacity: ${schoolInfo.capacity})`} )} @@ -716,10 +716,10 @@ export function SecondarySchoolDetailView({
Education, Health and Care Plan
)} - {latestResults?.total_pupils != null && ( + {(schoolInfo.total_pupils != null || latestResults?.total_pupils != null) && (
Total pupils
-
{latestResults.total_pupils.toLocaleString()}
+
{(schoolInfo.total_pupils ?? latestResults!.total_pupils!).toLocaleString()}
{schoolInfo.capacity != null && (
Capacity: {schoolInfo.capacity}
)}