@extends('layouts.admin') @section('title', 'Results — ' . $examSession->name) @section('page-title', 'Session Results') @section('content') {{-- Page Header --}}
{{ $examSession->name }}
{{ \Carbon\Carbon::parse($examSession->start_time)->format('d M Y, H:i') }} → {{ \Carbon\Carbon::parse($examSession->end_time)->format('H:i') }} {{ $examSession->duration_minutes }} mins {{ $attempts->total() }} submitted
Export CSV All Sessions
{{-- Summary Cards --}} @php $allAttempts = $attempts->getCollection(); $totalCount = $attempts->total(); $avgScore = $totalCount ? round($allAttempts->avg('total_score'), 1) : 0; $highScore = $totalCount ? $allAttempts->max('total_score') : 0; $passCount = $allAttempts->filter(fn($a) => $a->total_questions > 0 && ($a->total_score / $a->total_questions) >= 0.5)->count(); $passRate = $totalCount ? round(($passCount / $totalCount) * 100) : 0; @endphp
Total Submissions
{{ $totalCount }}
Average Score
{{ $avgScore }}
Highest Score
{{ $highScore }}
Pass Rate (≥50%)
{{ $passRate }}%
{{-- Results Table --}}
Candidate Results {{ $totalCount }}
Ranked by score (highest first)
@forelse($attempts as $index => $attempt) @php $percentage = $attempt->total_questions > 0 ? round(($attempt->total_score / $attempt->total_questions) * 100) : 0; $rank = ($attempts->currentPage() - 1) * $attempts->perPage() + $index + 1; $badgeColor = $percentage >= 70 ? 'success' : ($percentage >= 50 ? 'warning' : 'danger'); $rankIcon = $rank === 1 ? '🥇' : ($rank === 2 ? '🥈' : ($rank === 3 ? '🥉' : '')); @endphp {{-- Rank --}} {{-- Candidate Name --}} {{-- Reg Number --}} {{-- Subjects attempted --}} {{-- Score --}} {{-- Percentage bar --}} {{-- Status --}} {{-- Submitted At --}} {{-- Action --}} @empty @endforelse
# Candidate Reg Number Subjects Score Percentage Status Submitted Action
{{ $rankIcon ?: $rank }}
{{ $attempt->user->name }}
{{ $attempt->user->email }}
{{ $attempt->user->studentProfile->reg_number ?? '—' }} @if($attempt->results->isNotEmpty())
@foreach($attempt->results->take(4) as $result) {{ $result->subject->code ?? $result->subject->name ?? '—' }} @endforeach @if($attempt->results->count() > 4) +{{ $attempt->results->count() - 4 }} @endif
@else @endif
{{ $attempt->total_score }} / {{ $attempt->total_questions }}
{{ $percentage }}%
@if($attempt->status === 'submitted') Submitted @elseif($attempt->status === 'timed_out') Timed Out @else {{ ucfirst($attempt->status) }} @endif @if($attempt->submitted_at) {{ \Carbon\Carbon::parse($attempt->submitted_at)->format('d M Y') }}
{{ \Carbon\Carbon::parse($attempt->submitted_at)->format('H:i') }} @else — @endif
No submissions found for this session yet.
{{-- Pagination --}} @if($attempts->hasPages()) @endif
{{-- Per-Candidate Detail Modals --}} @foreach($attempts as $attempt) @php $pct = $attempt->total_questions > 0 ? round(($attempt->total_score / $attempt->total_questions) * 100) : 0; @endphp @endforeach @endsection