extend('layout/management_layout') ?> section('content') ?> 0 ? round($totalConfirmed / $totalPredicted * 100) : ($totalActual === 0 ? 100 : 0); $pct = static function (int $count, int $total): string { return $total > 0 ? number_format(($count / $total) * 100, 1) . '%' : '0.0%'; }; $genderKey = static function (?string $gender): string { $value = strtolower(trim((string)$gender)); return match (true) { in_array($value, ['male', 'm', 'boy', 'boys'], true) => 'boys', in_array($value, ['female', 'f', 'girl', 'girls'], true) => 'girls', default => 'other', }; }; $genderStats = static function (array $items) use ($genderKey): array { $stats = ['boys' => 0, 'girls' => 0, 'other' => 0]; foreach ($items as $item) { $stats[$genderKey($item['gender'] ?? '')]++; } return $stats; }; // Winner gender breakdown. // "Winner" means actual year-end trophy winner. $totalWinnerBoys = 0; $totalWinnerGirls = 0; $totalWinnerOther = 0; $allStudentsFlat = []; $passStudents = []; $trophyStudents = []; // Sticker names. // 2 columns x 7 rows = 14 stickers per page. // Stickers print name and class section. $stickerColumns = 2; $stickerRows = 7; $stickerWidthInches = 4.0; $stickerHeightInches = 1.33; $stickerPrintablePageWidthInches = 8.0; $stickerPrintablePageHeightInches = 10.5; $stickersPerPage = $stickerColumns * $stickerRows; $winnerStickers = []; foreach ($classResults as $cls) { foreach (($cls['students'] ?? []) as $s) { $allStudentsFlat[] = $s; if (isset($s['year_score']) && is_numeric($s['year_score']) && (float)$s['year_score'] >= 60) { $passStudents[] = $s; } if (empty($s['actual'])) { continue; } $trophyStudents[] = $s; $gender = strtolower(trim((string)($s['gender'] ?? ''))); if (in_array($gender, ['male', 'm', 'boy', 'boys'], true)) { $totalWinnerBoys++; } elseif (in_array($gender, ['female', 'f', 'girl', 'girls'], true)) { $totalWinnerGirls++; } else { $totalWinnerOther++; } $name = trim((string)($s['name'] ?? '')); $sectionName = trim((string)($cls['section_name'] ?? '')); if ($name !== '') { $winnerStickers[] = [ 'name' => $name, 'section' => $sectionName, ]; } } } $totalWinners = $totalWinnerBoys + $totalWinnerGirls + $totalWinnerOther; $winnerBoysPct = $totalWinners > 0 ? round(($totalWinnerBoys / $totalWinners) * 100, 1) : 0; $winnerGirlsPct = $totalWinners > 0 ? round(($totalWinnerGirls / $totalWinners) * 100, 1) : 0; $winnerOtherPct = $totalWinners > 0 ? round(($totalWinnerOther / $totalWinners) * 100, 1) : 0; $allGenderStats = $genderStats($allStudentsFlat); $passGenderStats = $genderStats($passStudents); $trophyGenderStats = $genderStats($trophyStudents); $totalPass = count($passStudents); ?>

Final vs Predicted —

Compares the Fall-score prediction (th percentile) with the year-end result based on the average of Fall & Spring scores.

Back
%
No data found for the selected school year.
✓ Confirmed Predicted AND got a year-end trophy ↑ Surprise NOT predicted, but earned a trophy ↓ Missed Predicted, but fell short year-end — None No trophy either way
0 ? round($totalPredicted / $totalStudents * 100) . '% of students' : '—'], [$totalActual, 'Actual (Year)', 'warning', 'dark', $totalStudents > 0 ? round($totalActual / $totalStudents * 100) . '% of students' : '—'], [$totalConfirmed, 'Confirmed', 'success', null, $totalPredicted > 0 ? round($totalConfirmed / $totalPredicted * 100) . '% of predicted' : '—'], [$totalSurprise, 'Surprises', 'info', 'dark', 'Not in prediction'], [$totalMissed, 'Missed', 'orange', null, 'Were predicted'], [$overallAccuracy,'Accuracy', 'dark', null, 'prediction rate'], ] as [$val, $label, $color, $textClass, $sub]): $isOrange = $color === 'orange'; $bgClass = $isOrange ? '' : 'bg-' . $color; $txClass = $textClass ? 'text-' . $textClass : 'text-white'; ?>
>
predicted actual 0): ?> confirmed 0): ?> surprise 1 ? 's' : '' ?> 0): ?> missed
Fall ≥ Year ≥ Accuracy: %
'table-success', 'surprise' => 'table-primary', 'missed' => 'table-warning', default => '', }; ?>
# Name Gender Fall Spring Year Avg Predicted Actual Status
—' ?> —' ?> —' ?> Yes' : 'No' ?> Yes' : 'No' ?> print '✓ Confirmed', 'surprise' => print '↑ Surprise', 'missed' => print '↓ Missed', default => print '', }; ?>
Prediction Accuracy Summary —
Class Students Predicted Actual ✓ Confirmed ↑ Surprises ↓ Missed Accuracy Fall ≥ Year ≥
%
Total %
Trophy Counts per Class
Prediction Accuracy per Class
Overall Outcome Breakdown
Winner Gender Breakdown
Total Winners
Actual year-end trophy winners
Boys
%
Girls
%
0): ?>
Boys %
Girls %
No winners
section('scripts') ?> endSection() ?> endSection() ?>