quiz #3

Merged
nik.polishuk merged 9 commits from quiz into main 2023-12-12 15:19:52 +03:00
4 changed files with 22 additions and 17 deletions
Showing only changes of commit 2588a72b02 - Show all commits

View File

@ -2,7 +2,7 @@ import React from "react";
import suucessIcon from "assets/images/quiz/success.png";
export const AlertResult = ({info}) => {
export const AlertResult = ({ info }) => {
const successTest = false;
return (

View File

@ -2,12 +2,12 @@ import React from "react";
import StarRating from "@components/StarRating/StarRating";
export const QuizReport = ({info}) => {
export const QuizReport = ({ info }) => {
function correctAnswers() {
return info.number_questions * info.percent_correct_answers
return info.number_questions * info.percent_correct_answers;
}
function correctWrongAnswers() {
return info.number_questions * (1 - info.percent_correct_answers)
return info.number_questions * (1 - info.percent_correct_answers);
}
return (
<div className="report">
@ -19,16 +19,18 @@ export const QuizReport = ({info}) => {
countActiveStars={0.5}
size={61}
/>
<div className="report__job-title">
{info.questionnaire_title}
</div>
<div className="report__job-title">{info.questionnaire_title}</div>
</div>
<div className="report__column">
<div className="report__value">{Boolean(correctAnswers()) ? correctAnswers() : 0}</div>
<div className="report__value">
{Boolean(correctAnswers()) ? correctAnswers() : 0}
</div>
<div className="report__text">Правильных ответов</div>
</div>
<div className="report__column">
<div className="report__value report__value_false">{Boolean(correctWrongAnswers()) ? correctWrongAnswers() : 0}</div>
<div className="report__value report__value_false">
{Boolean(correctWrongAnswers()) ? correctWrongAnswers() : 0}
</div>
<div className="report__text">Не правильных ответов</div>
</div>
<div className="report__column">

View File

@ -7,9 +7,9 @@ import { useTimer } from "react-timer-hook";
import { completedTestSelector } from "@redux/quizSlice";
import { Footer } from "@components/Common/Footer/Footer";
import { Navigation } from "@components/Navigation/Navigation";
import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadcrumbs";
import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader";
import { Navigation } from "@components/Navigation/Navigation";
// import { HeadBottom } from "@components/features/Candidate-lk/HeadBottom";
import { BlockCompletedTest } from "@components/features/quiz/BlockCompletedTest";
import { CardIntroduction } from "@components/features/quiz/Card-introduction";

View File

@ -4,14 +4,15 @@ import { useNavigate, useParams } from "react-router-dom";
import { selectedTest } from "@redux/quizSlice";
import { apiRequest } from "@api/request";
import { Footer } from "@components/Common/Footer/Footer";
import { Navigation } from "@components/Navigation/Navigation";
import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadcrumbs";
import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader";
import { Navigation } from "@components/Navigation/Navigation";
// import { HeadBottom } from "@components/features/Candidate-lk/HeadBottom";
import { AlertResult } from "@components/features/quiz/AlertResult";
import { QuizReport } from "@components/features/quiz/QuizReport";
import { apiRequest } from "@api/request";
export const QuizReportPage = () => {
const test = useSelector(selectedTest);
@ -23,12 +24,14 @@ export const QuizReportPage = () => {
}
useEffect(() => {
apiRequest(`/user-questionnaire/questionnaire-completed?user_questionnaire_uuid=${params.uuid}`).then((res) => {
setTestInfo(res)
})
}, [])
apiRequest(
`/user-questionnaire/questionnaire-completed?user_questionnaire_uuid=${params.uuid}`
).then((res) => {
setTestInfo(res);
});
}, []);
const [testInfo, setTestInfo] = useState({})
const [testInfo, setTestInfo] = useState({});
return (
<div className="quiz-report-page">