@extends('frontend.layouts.app')
@php
$cookie = \Illuminate\Support\Facades\Cookie::get('RuserSelectedanswers');
$userSelectedAnswers = json_decode($cookie, true);
$username = Auth::user()->name;
$totalQuestions = count($questions);
$correctCount = 0;
$incorrectCount = 0;
foreach ($questions as $question) {
$selectedAnswer = $userSelectedAnswers[$question->id] ?? null;
$correctAnswer = $question->answer->where('is_correct', '1')->first();
if ($selectedAnswer && $correctAnswer && $selectedAnswer == $correctAnswer->id) {
$correctCount++;
} elseif ($selectedAnswer) {
$incorrectCount++;
}
}
@endphp
@push('css')
@endpush
@section('content')
@endsection
@push('js')
@endpush