This commit is contained in:
Mikola 2023-12-12 11:23:06 +03:00
parent 6e2a14d58e
commit 2588a72b02
4 changed files with 22 additions and 17 deletions

View File

@ -4,10 +4,10 @@ import StarRating from "@components/StarRating/StarRating";
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">