@extends('layouts.portal') @section('title', 'Attempt review') @section('subtitle', $exam->title.' · '.$attempt->code) @section('actions') All attempts @if($attempt->isFinished() && Route::has('exams.report')) Score report (PDF)@endif @endsection @section('content') @php $u = $attempt->user; $fmt = fn ($s) => $s >= 3600 ? intdiv($s, 3600).'h '.intdiv($s % 3600, 60).'m' : intdiv($s, 60).'m '.($s % 60).'s'; $voided = $attempt->status === 'voided'; $pct = $attempt->percent !== null ? (float) $attempt->percent : null; $num = fn ($v) => rtrim(rtrim(number_format((float) $v, 2), '0'), '.'); $eventLabels = ['tab_hidden' => 'Switched to another tab', 'window_blur' => 'Window lost focus', 'fullscreen_exit' => 'Left full-screen', 'copy' => 'Tried to copy', 'paste' => 'Tried to paste', 'context_menu' => 'Opened the context menu', 'auto_submit' => 'Auto-submitted']; $credential = $attempt->credential; @endphp @if($voided)
This attempt was voided. It no longer counts toward the learner’s attempt limit and is excluded from pass rates.@if($attempt->void_reason)
Reason: {{ $attempt->void_reason }}@endif
@endif
{{ $u ? initials($u->name) : '?' }}

{{ $u?->name ?? 'Deleted user' }}

{{ $u?->email }}
Attempt #{{ $attempt->attempt_no }} @if($attempt->auto_submitted)Auto-submitted@endif
@if($pct !== null)
{{ round($pct) }}%
@if($voided)Voided @elseif($attempt->passed)Passed@elseFailed@endif
{{ $num($attempt->score) }} of {{ $num($attempt->max_score) }} marks · pass mark {{ $exam->pass_percent }}%
@else
Not scored — attempt {{ str_replace('_', ' ', $attempt->status) }}.
@endif
Started
{{ $attempt->started_at?->format('d M Y, g:i A') }}
Submitted
{{ $attempt->submitted_at?->format('d M Y, g:i A') ?? '—' }}
Time used
{{ $attempt->time_spent_seconds ? $fmt($attempt->time_spent_seconds) : '—' }} of {{ $exam->duration_minutes }} min
Answered
{{ $attempt->answeredCount() }} of {{ count((array) $attempt->question_ids) }} questions
Proctoring
{{ ucfirst($exam->proctor_level) }} · {{ $attempt->violations }} {{ \Illuminate\Support\Str::plural('violation', $attempt->violations) }}@if($exam->proctor_level === 'strict') (limit {{ $exam->max_violations }})@endif
IP address
{{ $attempt->ip_address ?: '—' }}
@if($attempt->user_agent)

Browser: {{ $attempt->user_agent }}

@endif
@if(! empty($attempt->domain_scores))

Score by domain

@foreach($attempt->domain_scores as $name => $d) @php $p = (float) ($d['percent'] ?? 0); @endphp
{{ $name ?: 'General' }}{{ round($p) }}% ({{ $d['correct'] ?? 0 }}/{{ $d['total'] ?? 0 }})
@endforeach
@endif

Answers vs key

@if(count($review)){{ collect($review)->where('is_correct', true)->count() }} correct · {{ collect($review)->where('answered', false)->count() }} unanswered@endif
@forelse($review as $r)
Question {{ $r['no'] }}@if($r['domain']){{ $r['domain'] }}@endif {{ ! $r['answered'] ? 'Unanswered' : ($r['is_correct'] ? 'Correct' : 'Incorrect') }}
{{ $r['question'] }}
Given@if($r['answered'])
    @foreach($r['given'] as $g)
  • {{ $g }}
  • @endforeach
@elseNo answer@endif
Correct
    @foreach($r['correct'] as $g)
  • {{ $g }}
  • @endforeach
@if($r['explanation'])

Explanation. {{ $r['explanation'] }}

@endif
@empty
@endforelse
@endsection