@extends('layout.app', ['title' => 'Kết quả kiểm tra'])
@push('style')
@vite(['resources/css/landing.css', 'resources/css/level-test.css'])
@endpush
@php
use App\Enums\QuestionLabelEnum;
function getLabelClass($label, $answer, $correct)
{
if ($label === $correct && $correct === $answer) {
return 'answered-correct'; // cau tra loi dung voi dap an va dung voi label
}
if ($label === $correct && $answer !== $correct) {
return 'answer-correct'; // cau tra loi dung khong dung voi dap an va nhung dung voi label
}
if ($label === $answer && $answer !== $correct) {
return 'answer-wrong'; // cau tra loi sai voi dap an va sai voi label
}
return '';
}
// get so checkbox de hien thi dua vao truong choices
// $answerLabel=["A","B","C",...]
function getAnswerLabels($choices): array
{
$choicesArray = $choices ? json_decode($choices, true) : ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'];
return QuestionLabelEnum::getAnswerLabels(count($choicesArray));
}
function evaluateRating($percentCorrectAnswers)
{
if ($percentCorrectAnswers >= 90) {
return 'A';
} elseif ($percentCorrectAnswers >= 80) {
return 'B';
} elseif ($percentCorrectAnswers >= 70) {
return 'C';
} elseif ($percentCorrectAnswers >= 60) {
return 'D';
} else {
return 'F';
}
}
function evaluateLevel($percentCorrectAnswers)
{
if ($percentCorrectAnswers >= 60) {
return 'Đạt';
} else {
return 'Không Đạt';
}
}
$descriptions = [
'Đặt ra mục tiêu, đam mê, và không ngừng nỗ lực - thành công sẽ là thành tựu của những ai kiên trì và không bao giờ từ bỏ.',
'Những nỗ lực hôm nay sẽ thắp sáng con đường tương lai của bạn. Hãy tin tưởng vào bản thân và tiến lên với mục tiêu rực rỡ!',
'Hãy kiên trì và nỗ lực, thành công sẽ đến với những ai không ngừng cố gắng.',
'Chăm chỉ hôm nay, thành công ngày mai – bạn đang trên đường chinh phục ước mơ!',
];
$randomDescription = $descriptions[array_rand($descriptions)];
@endphp
@section('content')