44 lines
1.4 KiB
React
Raw Normal View History

2023-05-31 08:36:15 +03:00
import React from "react";
import StarRating from "@components/StarRating/StarRating";
2023-12-12 11:23:06 +03:00
export const QuizReport = ({ info }) => {
2023-12-12 11:22:53 +03:00
function correctAnswers() {
2023-12-12 11:23:06 +03:00
return info.number_questions * info.percent_correct_answers;
2023-12-12 11:22:53 +03:00
}
function correctWrongAnswers() {
2023-12-12 11:23:06 +03:00
return info.number_questions * (1 - info.percent_correct_answers);
2023-12-12 11:22:53 +03:00
}
2023-05-31 08:36:15 +03:00
return (
<div className="report">
<div className="report__row">
<div className="report__column">
<StarRating
color={"#52B709"}
countStars={1}
countActiveStars={0.5}
size={61}
/>
2023-12-12 11:23:06 +03:00
<div className="report__job-title">{info.questionnaire_title}</div>
2023-05-31 08:36:15 +03:00
</div>
<div className="report__column">
2023-12-12 11:23:06 +03:00
<div className="report__value">
{Boolean(correctAnswers()) ? correctAnswers() : 0}
</div>
2023-05-31 08:36:15 +03:00
<div className="report__text">Правильных ответов</div>
</div>
<div className="report__column">
2023-12-12 11:23:06 +03:00
<div className="report__value report__value_false">
{Boolean(correctWrongAnswers()) ? correctWrongAnswers() : 0}
</div>
2023-05-31 08:36:15 +03:00
<div className="report__text">Не правильных ответов</div>
</div>
<div className="report__column">
<div className="report__status-text">Статус:</div>
<div className="report__status">Пройдено!</div>
</div>
</div>
</div>
);
};