{{ app()->getLocale() === 'ar' ? 'المقرر: ' : 'Course: ' }}{{ $course->name }}
{{ app()->getLocale() === 'ar' ? 'المادة: ' : 'Subject: ' }}{{ $course->subject?->name ?? '—' }}
{{ app()->getLocale() === 'ar' ? 'الفصل: ' : 'Class: ' }}{{ $course->schoolClass?->name ?? '—' }}
{{ app()->getLocale() === 'ar' ? 'عدد الاختبارات: ' : 'Tests: ' }}{{ $marks->count() }}
@php
$allScores = $marks->flatMap(fn($m) => $m->students->whereNotNull('mark')->pluck('mark'));
$avgScore = $allScores->count() ? round($allScores->avg(), 1) : null;
$maxScore = $allScores->count() ? $allScores->max() : null;
$minScore = $allScores->count() ? $allScores->min() : null;
$totalStudents = $marks->first()?->students->count() ?? 0;
$absentTotal = $marks->sum(fn($m) => $m->students->where('absent', true)->count());
@endphp