/** * GcseSection — KS4 headline results. Secondary pages. Server component. */ import type { School, SchoolResult } from '@/lib/types'; import { formatPercentage, formatProgress, formatAcademicYear } from '@/lib/utils'; import { MetricTooltip } from '../MetricTooltip'; import { DeltaChip } from '../DeltaChip'; import { SpecialSchoolNote } from '../SpecialSchoolNote'; import { Section, sectionStyles as styles, progressClass } from './sectionShared'; export function GcseSection({ latestResults, schoolInfo, secondaryAvg, p8Suspended, suppressComparison, }: { latestResults: SchoolResult; schoolInfo: School; secondaryAvg: Record; p8Suspended: boolean; suppressComparison: boolean; }) { return (

GCSE Results ({formatAcademicYear(latestResults.year)})

GCSE results for Year 11 pupils.{!suppressComparison && ' England averages shown for comparison.'}

{p8Suspended && (
Progress 8 isn't published for 2024/25: this GCSE year group sat no KS2 tests (COVID), so DfE has no starting point to measure their progress from.
)} {/* Hero stat cards — top GCSE metrics */}
{latestResults.attainment_8_score != null && (
Attainment 8 score
{latestResults.attainment_8_score.toFixed(1)} {!suppressComparison && secondaryAvg.attainment_8_score != null && ( )}
{!suppressComparison && secondaryAvg.attainment_8_score != null && (
England avg: {secondaryAvg.attainment_8_score.toFixed(1)}
)}
)} {latestResults.progress_8_score != null && (
Progress 8 score
{formatProgress(latestResults.progress_8_score)}
{(latestResults.progress_8_lower_ci != null && latestResults.progress_8_upper_ci != null) ? (
CI: {latestResults.progress_8_lower_ci.toFixed(2)} to {latestResults.progress_8_upper_ci.toFixed(2)}
) : (
National baseline: 0.0
)}
)} {latestResults.english_maths_strong_pass_pct != null && (
English & Maths Grade 5+
{formatPercentage(latestResults.english_maths_strong_pass_pct)} {!suppressComparison && secondaryAvg.english_maths_strong_pass_pct != null && ( )}
{!suppressComparison && secondaryAvg.english_maths_strong_pass_pct != null && (
England avg: {secondaryAvg.english_maths_strong_pass_pct.toFixed(0)}%
)}
)} {latestResults.english_maths_standard_pass_pct != null && (
English & Maths Grade 4+
{formatPercentage(latestResults.english_maths_standard_pass_pct)} {!suppressComparison && secondaryAvg.english_maths_standard_pass_pct != null && ( )}
{!suppressComparison && secondaryAvg.english_maths_standard_pass_pct != null && (
England avg: {secondaryAvg.english_maths_standard_pass_pct.toFixed(0)}%
)}
)}
{/* Attainment 8 visual bar (0–80 scale). This viz is explicitly "school vs national", so it's dropped for special schools where that comparison isn't meaningful. */} {!suppressComparison && latestResults.attainment_8_score != null && (
Attainment 8 — school vs national
{secondaryAvg.attainment_8_score != null && (
Nat avg {secondaryAvg.attainment_8_score.toFixed(1)}
)}
020406080
)} {/* Progress 8 number line with CI */} {latestResults.progress_8_score != null && !p8Suspended && (
Progress 8 — relative to national baseline (0)
{(() => { const p8 = latestResults.progress_8_score!; const lo = latestResults.progress_8_lower_ci ?? p8; const hi = latestResults.progress_8_upper_ci ?? p8; const range = 6; // −3 to +3 const toX = (v: number) => `${Math.min(Math.max(((v + 3) / range) * 100, 0), 100)}%`; return (
{/* CI band */}
{/* Zero line */}
{/* Score dot */}
); })()}
−3−2−10+1+2+3
)} {/* Progress 8 component breakdown */} {(latestResults.progress_8_english != null || latestResults.progress_8_maths != null || latestResults.progress_8_ebacc != null || latestResults.progress_8_open != null) && ( <>

Attainment 8 Components (Progress 8 contribution)

{[ { label: 'English', val: latestResults.progress_8_english }, { label: 'Maths', val: latestResults.progress_8_maths }, { label: 'EBacc subjects', val: latestResults.progress_8_ebacc }, { label: 'Open (other GCSEs)', val: latestResults.progress_8_open }, ].filter(r => r.val != null).map(({ label, val }) => (
{label} {formatProgress(val!)}
))}
)} {/* EBacc */} {(latestResults.ebacc_entry_pct != null || latestResults.ebacc_standard_pass_pct != null) && ( <>

English Baccalaureate (EBacc)

{latestResults.ebacc_entry_pct != null && (
Pupils entered for EBacc {formatPercentage(latestResults.ebacc_entry_pct)}
)} {latestResults.ebacc_standard_pass_pct != null && (
EBacc Grade 4+ {formatPercentage(latestResults.ebacc_standard_pass_pct)}
)} {latestResults.ebacc_strong_pass_pct != null && (
EBacc Grade 5+ {formatPercentage(latestResults.ebacc_strong_pass_pct)}
)} {latestResults.ebacc_avg_score != null && (
EBacc average point score {latestResults.ebacc_avg_score.toFixed(2)}
)}
)}
); }