analytica-frontend-lib 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MultipleChoice/index.js.map +1 -1
- package/dist/MultipleChoice/index.mjs.map +1 -1
- package/dist/Quiz/index.js +37 -30
- package/dist/Quiz/index.js.map +1 -1
- package/dist/Quiz/index.mjs +37 -30
- package/dist/Quiz/index.mjs.map +1 -1
- package/dist/Quiz/useQuizStore/index.d.mts +1 -0
- package/dist/Quiz/useQuizStore/index.d.ts +1 -0
- package/dist/Quiz/useQuizStore/index.js +9 -0
- package/dist/Quiz/useQuizStore/index.js.map +1 -1
- package/dist/Quiz/useQuizStore/index.mjs +9 -0
- package/dist/Quiz/useQuizStore/index.mjs.map +1 -1
- package/dist/index.js +37 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +37 -30
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/Quiz/index.mjs
CHANGED
|
@@ -1414,6 +1414,15 @@ var useQuizStore = create2()(
|
|
|
1414
1414
|
(answer) => answer.questionId === questionId
|
|
1415
1415
|
);
|
|
1416
1416
|
return userAnswer ? userAnswer.answerStatus : null;
|
|
1417
|
+
},
|
|
1418
|
+
getQuestionIndex: (questionId) => {
|
|
1419
|
+
const { getActiveQuiz } = get();
|
|
1420
|
+
const activeQuiz = getActiveQuiz();
|
|
1421
|
+
if (!activeQuiz) return 0;
|
|
1422
|
+
const questionIndex = activeQuiz.quiz.questions.findIndex(
|
|
1423
|
+
(q) => q.id === questionId
|
|
1424
|
+
);
|
|
1425
|
+
return questionIndex + 1;
|
|
1417
1426
|
}
|
|
1418
1427
|
};
|
|
1419
1428
|
},
|
|
@@ -5324,7 +5333,8 @@ var QuizQuestionList = ({
|
|
|
5324
5333
|
const {
|
|
5325
5334
|
getQuestionsGroupedBySubject,
|
|
5326
5335
|
goToQuestion,
|
|
5327
|
-
getQuestionStatusFromUserAnswers
|
|
5336
|
+
getQuestionStatusFromUserAnswers,
|
|
5337
|
+
getQuestionIndex
|
|
5328
5338
|
} = useQuizStore();
|
|
5329
5339
|
const groupedQuestions = getQuestionsGroupedBySubject();
|
|
5330
5340
|
const getQuestionStatus = (questionId) => {
|
|
@@ -5351,13 +5361,6 @@ var QuizQuestionList = ({
|
|
|
5351
5361
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5352
5362
|
{}
|
|
5353
5363
|
);
|
|
5354
|
-
const getQuestionIndex = (questionId) => {
|
|
5355
|
-
const { bySimulated, byActivity, byQuestionary } = useQuizStore.getState();
|
|
5356
|
-
const quiz = bySimulated ?? byActivity ?? byQuestionary;
|
|
5357
|
-
if (!quiz) return 0;
|
|
5358
|
-
const index = quiz.questions.findIndex((q) => q.id === questionId);
|
|
5359
|
-
return index + 1;
|
|
5360
|
-
};
|
|
5361
5364
|
const getStatusLabel = (status) => {
|
|
5362
5365
|
switch (status) {
|
|
5363
5366
|
case "answered":
|
|
@@ -5695,9 +5698,7 @@ var QuizResultPerformance = forwardRef10(
|
|
|
5695
5698
|
if (quiz) {
|
|
5696
5699
|
quiz.questions.forEach((question) => {
|
|
5697
5700
|
const userAnswerItem = getUserAnswerByQuestionId(question.id);
|
|
5698
|
-
const
|
|
5699
|
-
const isCorrectOption = question?.options.find((op) => op.isCorrect);
|
|
5700
|
-
const isCorrect = userAnswer && userAnswer === isCorrectOption?.id;
|
|
5701
|
+
const isCorrect = userAnswerItem?.answerStatus == "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */;
|
|
5701
5702
|
if (isCorrect) {
|
|
5702
5703
|
correctAnswers++;
|
|
5703
5704
|
}
|
|
@@ -5814,9 +5815,7 @@ var QuizListResult = forwardRef10(({ className, onSubjectClick, ...props }, ref)
|
|
|
5814
5815
|
questions.forEach((question) => {
|
|
5815
5816
|
if (isQuestionAnswered(question.id)) {
|
|
5816
5817
|
const userAnswerItem = getUserAnswerByQuestionId(question.id);
|
|
5817
|
-
|
|
5818
|
-
const isCorrectOption = question?.options.find((op) => op.isCorrect);
|
|
5819
|
-
if (userAnswer === isCorrectOption?.id) {
|
|
5818
|
+
if (userAnswerItem?.answerStatus == "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */) {
|
|
5820
5819
|
correct++;
|
|
5821
5820
|
} else {
|
|
5822
5821
|
incorrect++;
|
|
@@ -5851,28 +5850,36 @@ var QuizListResultByMateria = ({
|
|
|
5851
5850
|
subject,
|
|
5852
5851
|
onQuestionClick
|
|
5853
5852
|
}) => {
|
|
5854
|
-
const {
|
|
5853
|
+
const {
|
|
5854
|
+
getQuestionsGroupedBySubject,
|
|
5855
|
+
getUserAnswerByQuestionId,
|
|
5856
|
+
getQuestionIndex
|
|
5857
|
+
} = useQuizStore();
|
|
5855
5858
|
const groupedQuestions = getQuestionsGroupedBySubject();
|
|
5856
5859
|
const answeredQuestions = groupedQuestions[subject] || [];
|
|
5857
5860
|
return /* @__PURE__ */ jsxs14("div", { className: "w-full max-w-[1000px] flex flex-col mx-auto h-full relative not-lg:px-6", children: [
|
|
5858
5861
|
/* @__PURE__ */ jsx17("div", { className: "flex flex-row pt-4 justify-between", children: /* @__PURE__ */ jsx17("p", { className: "text-text-950 font-bold text-2xl", children: subject }) }),
|
|
5859
5862
|
/* @__PURE__ */ jsxs14("section", { className: "flex flex-col ", children: [
|
|
5860
5863
|
/* @__PURE__ */ jsx17("p", { className: "pt-6 pb-4 text-text-950 font-bold text-lg", children: "Resultado das quest\xF5es" }),
|
|
5861
|
-
/* @__PURE__ */ jsx17("ul", { className: "flex flex-col gap-2 pt-4", children: answeredQuestions.map((question) =>
|
|
5862
|
-
|
|
5863
|
-
{
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
|
|
5864
|
+
/* @__PURE__ */ jsx17("ul", { className: "flex flex-col gap-2 pt-4", children: answeredQuestions.map((question) => {
|
|
5865
|
+
const questionIndex = getQuestionIndex(question.id);
|
|
5866
|
+
return /* @__PURE__ */ jsx17("li", { children: /* @__PURE__ */ jsx17(
|
|
5867
|
+
CardStatus,
|
|
5868
|
+
{
|
|
5869
|
+
className: "max-w-full",
|
|
5870
|
+
header: `Quest\xE3o ${questionIndex.toString().padStart(2, "0")}`,
|
|
5871
|
+
status: (() => {
|
|
5872
|
+
const userAnswer = getUserAnswerByQuestionId(question.id);
|
|
5873
|
+
if (userAnswer?.answerStatus === "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */)
|
|
5874
|
+
return "correct";
|
|
5875
|
+
if (userAnswer?.answerStatus === "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */)
|
|
5876
|
+
return "incorrect";
|
|
5877
|
+
return void 0;
|
|
5878
|
+
})(),
|
|
5879
|
+
onClick: () => onQuestionClick?.(question)
|
|
5880
|
+
}
|
|
5881
|
+
) }, question.id);
|
|
5882
|
+
}) })
|
|
5876
5883
|
] })
|
|
5877
5884
|
] });
|
|
5878
5885
|
};
|