@extends('admin.layouts.app') @section('content')
@if ( session('msg') )
{{ session('msg') }}
@endif
@php $quiz = $userQuiz->quiz()->withTrashed()->first(); $isApproved = $userQuiz->isApproved(); if($isApproved) { $status = 'Aprobado'; } else { $status = 'Perdido'; } @endphp
Total preguntas:

{{ count($quiz->questions()->withTrashed()->get()) }}

Porcentaje de aprobación:

{{ $quiz->minimum }}%

Porcentaje obtenido:

{{ $userQuiz->result }}%

Estado:

{{ $status }}

@foreach($userQuiz->answers as $key => $answer) @php $question = $answer->question()->withTrashed()->first(); $questionable = $question->questionable()->withTrashed()->first(); @endphp
@if($questionable->isCorrect($answer->answerable))
Pregunta Correcta
@else
Pregunta Incorrecta
@endif

Pregunta Nº{{ $key + 1 }} - Opción {{ $questionable->type() }}

{{ $question->question }}

@if($question->image) @endif
@if(get_class($questionable) == 'App\Models\Quizzes\Questions\MultipleOptionQuestion')

Opciónes

@foreach($questionable->options()->withTrashed()->get() as $option)
@php $selectedOptionCorrect = false; @endphp @foreach($answer->answerable->optionAnswers as $optionAnswer) @if($optionAnswer->option()->withTrashed()->first()->id == $option->id) @php $selectedOptionCorrect = true; @endphp @endif @endforeach @if($selectedOptionCorrect && $option->correct)
@elseif($selectedOptionCorrect && !$option->correct)
@else
@endif

{{ $option->option }}

@if($option->correct) (Correcta) @endif
@endforeach
@elseif(get_class($questionable) == 'App\Models\Quizzes\Questions\SimpleQuestion')

Respuesta

{{ $questionable->answer }}

@endif
@endforeach
@endsection