@extends('student.layouts.app') @section('title', app()->getLocale() === 'ar' ? 'نتيجة الاختبار' : 'Exam Result') @section('content') @php $isArabic = app()->getLocale() === 'ar'; $pct = $attempt->max_score > 0 ? round(($attempt->final_score / $attempt->max_score) * 100) : 0; $passed = $pct >= 50; @endphp
{{-- Score card --}}

{{ $passed ? ($isArabic ? 'ناجح' : 'Passed') : ($isArabic ? 'راسب' : 'Failed') }}

{{ $pct }}%

{{ $attempt->final_score }} / {{ $attempt->max_score }} {{ $isArabic ? 'درجة' : 'pts' }}

@if($attempt->status === 'submitted')

{{ $isArabic ? 'بعض الأسئلة تنتظر مراجعة المعلم' : 'Some answers pending teacher review' }}

@endif
{{-- Stats --}}

{{ $attempt->auto_score }}

{{ $isArabic ? 'درجات تلقائية' : 'Auto Score' }}

{{ $attempt->time_spent_seconds ? gmdate('i:s', $attempt->time_spent_seconds) : '—' }}

{{ $isArabic ? 'الوقت المستغرق' : 'Time Spent' }}

{{ $responses->count() }}

{{ $isArabic ? 'أسئلة أجبت عنها' : 'Answered' }}

{{-- Per-question review (only for auto_graded/graded) --}} @if(in_array($attempt->status, ['auto_graded','graded']) && $attempt->exam->result_visibility !== 'hidden') @foreach($attempt->exam->sections as $section)

{{ $section->title }}

@foreach($section->questions as $sq) @php $resp = $responses[$sq->id] ?? null; $q = $sq->question; $correct = $resp && $resp->auto_score > 0; @endphp

{{ $q->prompt }}

@if($resp) {{ $resp->final_score }}/{{ $sq->points }} @endif
@if($q->model_answer && !$correct)

{{ $isArabic ? 'الإجابة الصحيحة:' : 'Correct:' }} {{ $q->model_answer }}

@endif @if($resp?->teacher_feedback)

{{ $resp->teacher_feedback }}

@endif
@endforeach
@endforeach @endif
{{ $isArabic ? 'رجوع' : 'Back' }}
@endsection