fix(detail): detect secondary schools by attainment_8_score, not just phase field
All checks were successful
Build and Push Docker Images / Build Backend (FastAPI) (push) Successful in 32s
Build and Push Docker Images / Build Frontend (Next.js) (push) Successful in 1m5s
Build and Push Docker Images / Build Pipeline (Meltano + dbt + Airflow) (push) Successful in 31s
Build and Push Docker Images / Trigger Portainer Update (push) Successful in 1s

Schools with phases like "All-through" or null phase but with GCSE data
were falling through to the primary SchoolDetailView, rendering only
partial content. Now checks yearly_data for attainment_8_score as well.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-29 10:12:07 +01:00
parent 1d22877aec
commit 63dfa22255

View File

@@ -27,7 +27,8 @@ export async function generateMetadata({ params }: SchoolPageProps): Promise<Met
const data = await fetchSchoolDetails(urn);
const { school_info } = data;
const isSecondary = (school_info.phase ?? '').toLowerCase().includes('secondary');
const isSecondary = (school_info.phase ?? '').toLowerCase().includes('secondary')
|| (data.yearly_data ?? []).some((d: any) => d.attainment_8_score != null);
const title = `${school_info.school_name} | ${school_info.local_authority || 'England'}`;
const description = isSecondary
? `View GCSE results, Attainment 8, Progress 8 and school statistics for ${school_info.school_name}${school_info.local_authority ? ` in ${school_info.local_authority}` : ''}.`
@@ -85,7 +86,8 @@ export default async function SchoolPage({ params }: SchoolPageProps) {
const { school_info, yearly_data, absence_data, ofsted, parent_view, census, admissions, sen_detail, phonics, deprivation, finance } = data;
const isSecondary = (school_info.phase ?? '').toLowerCase().includes('secondary');
const isSecondary = (school_info.phase ?? '').toLowerCase().includes('secondary')
|| yearly_data.some((d: any) => d.attainment_8_score != null);
// Generate JSON-LD structured data for SEO
const structuredData = {