@foreach($attempt->answers as $i => $answer)
@php
$q = $answer->question;
$correct = $answer->is_correct;
$isEssay = in_array($q->type, ['essay', 'short_answer']);
@endphp
Q{{ $i+1 }}
@if(!is_null($correct))
{{ $correct ? '+' . $answer->marks_awarded : '0' }}/{{ $q->marks }} marks
@else
Manual grading required
@endif
{{ $q->question_text }}
@if($answer->selectedOption)
Your Answer:
{{ $answer->selectedOption->option_text }}
@if(!$correct && $q->correctOption())
Correct Answer:
{{ $q->correctOption()->option_text }}
@endif
@elseif($answer->text_answer)
Your Answer:
{{ $answer->text_answer }}
@endif
@if($q->explanation)
Explanation
{{ $q->explanation }}
@endif