@if ($questions->count() > 0)
@php
$numberQuestion = 0;
$total_para_ques = 0;
$list_correct_answers = [];
$exam_type = $test->exam_type;
$section_data = json_decode($test->section_data);
$que_json = json_decode($questions);
@endphp
@if($exam_type!="NSNT")
@foreach ($section_data as $sec_val)
@php
$section_name = $sec_val->section_name;
$sec_questions = $sec_val->questions;
@endphp
Section: {{$section_name}}
@foreach ($sec_questions as $sec_que_id)
@php
$arrkey = array_keys(array_column($que_json, 'id'), $sec_que_id);
//dd($arrkey[0]);
$question = $que_json[$arrkey[0]];
$question = (object) $question;
@endphp
@if (!is_null($question))
@if (in_array($question->question_type, ['para','video','audio', 'video_embed','audio_embed']))
@php
++$total_para_ques;
@endphp
@endif
@include('student.test.exam.questions.load', [
'question' => $question,
'total_para_ques' => $total_para_ques,
'numberQuestion' => $numberQuestion = $numberQuestion + 1,
'preview' => true
])
@php
$list_correct_answers[$question->id] = [
'type' => $question->question_type,
'correct_answers' => json_decode($question->correct_answers ?? null, true)
];
@endphp
@if ($question->question_type == "blanks" || $question->question_type == "match")
@php
$answer = $answers[$question->id] ?? [];
$answer = is_array($answer) ? array_filter($answer) : [];
@endphp
Answered:
{!! count($answer) > 0 ? implode($answer, ' and ') : null !!}
@endif
@endif
@endforeach
@endforeach
@else
@foreach ($questions as $question)
@php
$question = (object) $question;
@endphp
@if (!is_null($question))
@if (in_array($question->question_type, ['para','video','audio', 'video_embed','audio_embed']))
@php
++$total_para_ques;
@endphp
@endif
@include('student.test.exam.questions.load', [
'question' => $question,
'total_para_ques' => $total_para_ques,
'numberQuestion' => $numberQuestion = $numberQuestion + 1,
'preview' => true
])
@php
$list_correct_answers[$question->id] = [
'type' => $question->question_type,
'correct_answers' => json_decode($question->correct_answers ?? null, true)
];
@endphp
@if ($question->question_type == "blanks" || $question->question_type == "match")
@php
$answer = $answers[$question->id] ?? [];
$answer = is_array($answer) ? array_filter($answer) : [];
@endphp
Answered:
{!! count($answer) > 0 ? implode($answer, ' and ') : null !!}
@endif
@endif
@endforeach
@endif
@endif