fix(secondary): use GIAS total_pupils for school roll, not KS4 exam cohort
Build and Push Docker Images / Build Backend (FastAPI) (push) Successful in 16s
Build and Push Docker Images / Build Frontend (Next.js) (push) Successful in 53s
Build and Push Docker Images / Build Pipeline (Meltano + dbt + Airflow) (push) Successful in 13s
Build and Push Docker Images / Trigger Portainer Update (push) Successful in 1s

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 <noreply@anthropic.com>
This commit is contained in:
Tudor Sitaru
2026-04-09 16:04:41 +01:00
parent 06bf53ac26
commit 109fa14ccb
@@ -215,9 +215,9 @@ export function SecondarySchoolDetailView({
</a>
</span>
)}
{latestResults?.total_pupils != null && (
{(schoolInfo.total_pupils != null || latestResults?.total_pupils != null) && (
<span className={styles.headerDetail}>
<strong>Pupils:</strong> {latestResults.total_pupils.toLocaleString()}
<strong>Pupils:</strong> {(schoolInfo.total_pupils ?? latestResults!.total_pupils!).toLocaleString()}
{schoolInfo.capacity != null && ` (capacity: ${schoolInfo.capacity})`}
</span>
)}
@@ -716,10 +716,10 @@ export function SecondarySchoolDetailView({
<div className={styles.metricHint}>Education, Health and Care Plan</div>
</div>
)}
{latestResults?.total_pupils != null && (
{(schoolInfo.total_pupils != null || latestResults?.total_pupils != null) && (
<div className={styles.metricCard}>
<div className={styles.metricLabel}>Total pupils</div>
<div className={styles.metricValue}>{latestResults.total_pupils.toLocaleString()}</div>
<div className={styles.metricValue}>{(schoolInfo.total_pupils ?? latestResults!.total_pupils!).toLocaleString()}</div>
{schoolInfo.capacity != null && (
<div className={styles.metricHint}>Capacity: {schoolInfo.capacity}</div>
)}