@php $context = $analytics['context']; $summary = $analytics['summary']; $gradeDistribution = $analytics['grade_distribution']; $scoreBands = $analytics['score_bands']; $passFail = $analytics['pass_fail_analysis']; $subjects = $analytics['subject_performance']; $studentGrades = $analytics['student_grade_profile']; $arms = $analytics['arm_comparison']; $trends = $analytics['trend_analysis']; $rankings = $analytics['student_rankings']; $cumulative = $analytics['cumulative_analysis']; @endphp
{{ strtoupper($school->short_name ?? $school->name ?? 'School') }}

Results Analytics Report

{{ $sectionLabel }} for {{ $context['report_title'] ?? 'Selected Report' }}

Level{{ $context['level'] ?? '' }} Scope{{ $context['level_arm'] ?? 'All Arms' }} Term / Session{{ $context['term'] ?? '' }} | {{ $context['session'] ?? '' }} Generated{{ $generatedAt->format('M j, Y g:i A') }}
@if($section === 'overview')
Students Analysed{{ $summary['total_students'] }} Class Average{{ number_format($summary['class_average'], 2) }} Highest Average{{ number_format($summary['highest_average'], 2) }} Lowest Average{{ number_format($summary['lowest_average'], 2) }}

Grade Distribution

@foreach($gradeDistribution['items'] as $item)
{{ $item['grade'] }}
{{ $item['count'] }} students ({{ number_format($item['percentage'] ?? 0, 2) }}%)
@endforeach

Score Bands

@php $bandTotal = max(collect($scoreBands['items'])->sum('count'), 1); @endphp @foreach($scoreBands['items'] as $item) @php $bandPercent = round(($item['count'] / $bandTotal) * 100, 2); @endphp
{{ $item['band'] }}
{{ $item['count'] }} students
@endforeach

Grade Breakdown

@foreach($gradeDistribution['items'] as $item) @endforeach
GradeStudentsPercentage
{{ $item['grade'] }} {{ $item['count'] }} {{ number_format($item['percentage'] ?? 0, 2) }}%
@elseif($section === 'passfail')
Pass Mark{{ number_format($passFail['pass_mark'], 2) }} Pass Count{{ $passFail['overall']['pass_count'] }} Fail Count{{ $passFail['overall']['fail_count'] }} Pass Rate{{ number_format($passFail['overall']['pass_rate'], 2) }}%

Subject Pass and Fail Breakdown

@foreach($passFail['subject_items'] as $item)@endforeach
SubjectEntriesPassFailPass RateFail Rate
{{ $item['subject_name'] }}{{ $item['entries'] }}{{ $item['pass_count'] }}{{ $item['fail_count'] }}{{ number_format($item['pass_rate'], 2) }}%{{ number_format($item['fail_rate'], 2) }}%

Arm Pass and Fail Breakdown

@foreach($passFail['arm_items'] as $item)@endforeach
ArmStudentsPassFailPass RateFail Rate
{{ $item['level_arm'] }}{{ $item['students'] }}{{ $item['pass_count'] }}{{ $item['fail_count'] }}{{ number_format($item['pass_rate'], 2) }}%{{ number_format($item['fail_rate'], 2) }}%
@elseif($section === 'subjects')

Subject Performance Breakdown

Subject averages and grade composition from the scores table.

@foreach($subjects['grade_labels'] as $grade)@endforeach @foreach($subjects['items'] as $item) @foreach($subjects['grade_labels'] as $grade)@endforeach @endforeach
SubjectEntriesAverageHighestLowest{{ $grade }}
{{ $item['subject_name'] }}{{ $item['entries'] }}{{ number_format($item['average_score'], 2) }}{{ number_format($item['highest_score'], 2) }}{{ number_format($item['lowest_score'], 2) }}{{ $item['grade_counts'][$grade] ?? 0 }}
@elseif($section === 'studentgrades')

Student Grade Mix

@foreach($studentGrades['grade_labels'] as $grade)@endforeach@foreach($studentGrades['items'] as $item)@foreach($studentGrades['grade_labels'] as $grade)@endforeach@endforeach
StudentArmAverageFinal GradeSubjects{{ $grade }}
{{ $item['student_name'] }}{{ $item['level_arm'] }}{{ number_format($item['average_score'], 2) }}{{ $item['final_grade'] }}{{ $item['total_subjects'] }}{{ $item['grade_counts'][$grade] ?? 0 }}
@elseif($section === 'arms')

Arm Comparison

@foreach($arms['grade_labels'] as $grade)@endforeach@foreach($arms['items'] as $item)@foreach($arms['grade_labels'] as $grade)@endforeach@endforeach
ArmStudentsAverageHighestLowest{{ $grade }}
{{ $item['level_arm'] }}@if($item['is_selected']) (Selected)@endif{{ $item['student_count'] }}{{ number_format($item['average_score'], 2) }}{{ number_format($item['highest_score'], 2) }}{{ number_format($item['lowest_score'], 2) }}{{ $item['grade_counts'][$grade] ?? 0 }}
@elseif($section === 'trends')

Trend Analysis

@foreach($trends['items'] as $item)
{{ $item['label'] }}
Average: {{ number_format($item['class_average'], 2) }} | Highest: {{ number_format($item['highest_average'], 2) }} | Lowest: {{ number_format($item['lowest_average'], 2) }}
@endforeach
@foreach($trends['items'] as $item)@endforeach
ReportStudentsClass AverageHighestLowest
{{ $item['label'] }}@if($item['is_selected']) (Current)@endif{{ $item['student_count'] }}{{ number_format($item['class_average'], 2) }}{{ number_format($item['highest_average'], 2) }}{{ number_format($item['lowest_average'], 2) }}
@elseif($section === 'rankings')

Student Rankings

Top Performers
@foreach($rankings['top_performers'] as $item)@endforeach
StudentAverageGradeArm Pos.Level Pos.
{{ $item['student_name'] }}{{ number_format($item['average_score'], 2) }}{{ $item['grade'] }}{{ $item['position_in_arm'] }}{{ $item['position_in_level'] }}
Bottom Performers
@foreach($rankings['bottom_performers'] as $item)@endforeach
StudentAverageGradeArm Pos.Level Pos.
{{ $item['student_name'] }}{{ number_format($item['average_score'], 2) }}{{ $item['grade'] }}{{ $item['position_in_arm'] }}{{ $item['position_in_level'] }}
@elseif($section === 'cumulative')
Cumulative Average{{ number_format($cumulative['summary']['cumulative_average'], 2) }} Highest Cumulative{{ number_format($cumulative['summary']['highest_cumulative_average'], 2) }} Lowest Cumulative{{ number_format($cumulative['summary']['lowest_cumulative_average'], 2) }}

Cumulative Grade Distribution

@foreach($cumulative['cumulative_grade_distribution']['items'] as $item)
{{ $item['grade'] }}
{{ $item['count'] }} students ({{ number_format($item['percentage'] ?? 0, 2) }}%)
@endforeach
@foreach($cumulative['cumulative_grade_distribution']['items'] as $item)@endforeach
GradeStudentsPercentage
{{ $item['grade'] }}{{ $item['count'] }}{{ number_format($item['percentage'] ?? 0, 2) }}%
@endif