quiz
This commit is contained in:
parent
6e2a14d58e
commit
2588a72b02
@ -4,10 +4,10 @@ import StarRating from "@components/StarRating/StarRating";
|
|||||||
|
|
||||||
export const QuizReport = ({ info }) => {
|
export const QuizReport = ({ info }) => {
|
||||||
function correctAnswers() {
|
function correctAnswers() {
|
||||||
return info.number_questions * info.percent_correct_answers
|
return info.number_questions * info.percent_correct_answers;
|
||||||
}
|
}
|
||||||
function correctWrongAnswers() {
|
function correctWrongAnswers() {
|
||||||
return info.number_questions * (1 - info.percent_correct_answers)
|
return info.number_questions * (1 - info.percent_correct_answers);
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div className="report">
|
<div className="report">
|
||||||
@ -19,16 +19,18 @@ export const QuizReport = ({info}) => {
|
|||||||
countActiveStars={0.5}
|
countActiveStars={0.5}
|
||||||
size={61}
|
size={61}
|
||||||
/>
|
/>
|
||||||
<div className="report__job-title">
|
<div className="report__job-title">{info.questionnaire_title}</div>
|
||||||
{info.questionnaire_title}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="report__column">
|
<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 className="report__text">Правильных ответов</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="report__column">
|
<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 className="report__text">Не правильных ответов</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="report__column">
|
<div className="report__column">
|
||||||
|
@ -7,9 +7,9 @@ import { useTimer } from "react-timer-hook";
|
|||||||
import { completedTestSelector } from "@redux/quizSlice";
|
import { completedTestSelector } from "@redux/quizSlice";
|
||||||
|
|
||||||
import { Footer } from "@components/Common/Footer/Footer";
|
import { Footer } from "@components/Common/Footer/Footer";
|
||||||
|
import { Navigation } from "@components/Navigation/Navigation";
|
||||||
import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadcrumbs";
|
import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadcrumbs";
|
||||||
import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader";
|
import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader";
|
||||||
import { Navigation } from "@components/Navigation/Navigation";
|
|
||||||
// import { HeadBottom } from "@components/features/Candidate-lk/HeadBottom";
|
// import { HeadBottom } from "@components/features/Candidate-lk/HeadBottom";
|
||||||
import { BlockCompletedTest } from "@components/features/quiz/BlockCompletedTest";
|
import { BlockCompletedTest } from "@components/features/quiz/BlockCompletedTest";
|
||||||
import { CardIntroduction } from "@components/features/quiz/Card-introduction";
|
import { CardIntroduction } from "@components/features/quiz/Card-introduction";
|
||||||
|
@ -4,14 +4,15 @@ import { useNavigate, useParams } from "react-router-dom";
|
|||||||
|
|
||||||
import { selectedTest } from "@redux/quizSlice";
|
import { selectedTest } from "@redux/quizSlice";
|
||||||
|
|
||||||
|
import { apiRequest } from "@api/request";
|
||||||
|
|
||||||
import { Footer } from "@components/Common/Footer/Footer";
|
import { Footer } from "@components/Common/Footer/Footer";
|
||||||
|
import { Navigation } from "@components/Navigation/Navigation";
|
||||||
import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadcrumbs";
|
import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadcrumbs";
|
||||||
import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader";
|
import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader";
|
||||||
import { Navigation } from "@components/Navigation/Navigation";
|
|
||||||
// import { HeadBottom } from "@components/features/Candidate-lk/HeadBottom";
|
// import { HeadBottom } from "@components/features/Candidate-lk/HeadBottom";
|
||||||
import { AlertResult } from "@components/features/quiz/AlertResult";
|
import { AlertResult } from "@components/features/quiz/AlertResult";
|
||||||
import { QuizReport } from "@components/features/quiz/QuizReport";
|
import { QuizReport } from "@components/features/quiz/QuizReport";
|
||||||
import { apiRequest } from "@api/request";
|
|
||||||
|
|
||||||
export const QuizReportPage = () => {
|
export const QuizReportPage = () => {
|
||||||
const test = useSelector(selectedTest);
|
const test = useSelector(selectedTest);
|
||||||
@ -23,12 +24,14 @@ export const QuizReportPage = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
apiRequest(`/user-questionnaire/questionnaire-completed?user_questionnaire_uuid=${params.uuid}`).then((res) => {
|
apiRequest(
|
||||||
setTestInfo(res)
|
`/user-questionnaire/questionnaire-completed?user_questionnaire_uuid=${params.uuid}`
|
||||||
})
|
).then((res) => {
|
||||||
}, [])
|
setTestInfo(res);
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
const [testInfo, setTestInfo] = useState({})
|
const [testInfo, setTestInfo] = useState({});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="quiz-report-page">
|
<div className="quiz-report-page">
|
||||||
|
Loading…
Reference in New Issue
Block a user