@extends('layouts.app') @section('title', 'Exam Result') @section('content')
@if($attempt->passed)

Congratulations!

You passed the exam

@else

Better Luck Next Time

You did not meet the pass mark

@endif
{{ number_format($attempt->percentage, 1) }}%
Score
{{ $attempt->result->grade ?? 'N/A' }}
Grade
{{ $attempt->time_spent_seconds ? sprintf('%02d:%02d', floor($attempt->time_spent_seconds/60), $attempt->time_spent_seconds%60) : 'N/A' }}
Time Spent
Performance Breakdown
{{ $attempt->result->correct_answers ?? 0 }}
Correct
{{ $attempt->result->wrong_answers ?? 0 }}
Wrong
{{ $attempt->result->total_questions_answered ?? 0 }}
Answered
@php $correctPct = $attempt->result && $attempt->result->total_questions_answered > 0 ? ($attempt->result->correct_answers / ($attempt->result->correct_answers + $attempt->result->wrong_answers)) * 100 : 0; @endphp
{{ $attempt->result->correct_answers ?? 0 }} Correct
{{ $attempt->result->wrong_answers ?? 0 }} Wrong
@if($exam->show_result_immediately && $attempt->reviewed_answers)
Review Answers
@foreach($exam->questions as $qIndex => $question) @php $review = $attempt->reviewed_answers[$question->id] ?? null; @endphp
Q{{ $qIndex + 1 }}. {{ $review ? ($review['is_correct'] ? 'Correct' : 'Wrong') : 'Not Answered' }}

{!! nl2br(e($question->question_text)) !!}

@if($review)
Your answer:
{{ is_array($review['user_answer']) ? implode(', ', $review['user_answer']) : $review['user_answer'] }}
Correct answer:
{{ $review['correct_answer'] }}
@if($question->explanation)
Explanation: {{ $question->explanation }}
@endif @endif
@endforeach
@endif
@endsection