analytica-frontend-lib 1.2.69 → 1.2.71
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/ActivityCardQuestionBanks/index.js +8 -2
- package/dist/ActivityCardQuestionBanks/index.js.map +1 -1
- package/dist/ActivityCardQuestionBanks/index.mjs +8 -2
- package/dist/ActivityCardQuestionBanks/index.mjs.map +1 -1
- package/dist/ActivityCardQuestionPreview/index.js +8 -2
- package/dist/ActivityCardQuestionPreview/index.js.map +1 -1
- package/dist/ActivityCardQuestionPreview/index.mjs +8 -2
- package/dist/ActivityCardQuestionPreview/index.mjs.map +1 -1
- package/dist/ActivityDetails/index.d.ts +1 -1
- package/dist/ActivityDetails/index.d.ts.map +1 -1
- package/dist/ActivityDetails/index.js +55 -8
- package/dist/ActivityDetails/index.js.map +1 -1
- package/dist/ActivityDetails/index.mjs +55 -8
- package/dist/ActivityDetails/index.mjs.map +1 -1
- package/dist/ActivityPreview/index.js +8 -2
- package/dist/ActivityPreview/index.js.map +1 -1
- package/dist/ActivityPreview/index.mjs +8 -2
- package/dist/ActivityPreview/index.mjs.map +1 -1
- package/dist/CorrectActivityModal/index.js +54 -3
- package/dist/CorrectActivityModal/index.js.map +1 -1
- package/dist/CorrectActivityModal/index.mjs +54 -3
- package/dist/CorrectActivityModal/index.mjs.map +1 -1
- package/dist/index.js +55 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +55 -8
- package/dist/index.mjs.map +1 -1
- package/dist/utils/questionRenderer/alternative/index.d.ts.map +1 -1
- package/dist/utils/questionRenderer/multipleChoice/index.d.ts.map +1 -1
- package/dist/utils/studentActivityCorrection/utils.d.ts +14 -0
- package/dist/utils/studentActivityCorrection/utils.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -9607,8 +9607,53 @@ var getQuestionStatusBadgeConfig = (status) => {
|
|
|
9607
9607
|
};
|
|
9608
9608
|
return configs[status] ?? defaultConfig;
|
|
9609
9609
|
};
|
|
9610
|
+
var canAutoValidate = (questionData) => {
|
|
9611
|
+
const { result } = questionData;
|
|
9612
|
+
if (result.questionType === "DISSERTATIVA" /* DISSERTATIVA */) {
|
|
9613
|
+
return false;
|
|
9614
|
+
}
|
|
9615
|
+
return true;
|
|
9616
|
+
};
|
|
9617
|
+
var hasIsCorrect = (op) => {
|
|
9618
|
+
return op.isCorrect != null;
|
|
9619
|
+
};
|
|
9620
|
+
var validateAlternativa = (selected, options) => {
|
|
9621
|
+
if (selected.size !== 1) return "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */;
|
|
9622
|
+
const [selectedId] = selected;
|
|
9623
|
+
return options.find((o) => o.id === selectedId)?.isCorrect ? "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */ : "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */;
|
|
9624
|
+
};
|
|
9625
|
+
var validateMultiplaEscolha = (selected, options) => {
|
|
9626
|
+
const allMatch = options.every((op) => selected.has(op.id) === op.isCorrect);
|
|
9627
|
+
return allMatch ? "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */ : "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */;
|
|
9628
|
+
};
|
|
9629
|
+
var validateVerdadeiroFalso = validateMultiplaEscolha;
|
|
9630
|
+
var validators = {
|
|
9631
|
+
["ALTERNATIVA" /* ALTERNATIVA */]: validateAlternativa,
|
|
9632
|
+
["MULTIPLA_ESCOLHA" /* MULTIPLA_ESCOLHA */]: validateMultiplaEscolha,
|
|
9633
|
+
["VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */]: validateVerdadeiroFalso
|
|
9634
|
+
};
|
|
9635
|
+
var autoValidateQuestion = (questionData) => {
|
|
9636
|
+
const { result } = questionData;
|
|
9637
|
+
if (!canAutoValidate(questionData) || !result.options) return null;
|
|
9638
|
+
const validOptions = result.options.filter(hasIsCorrect);
|
|
9639
|
+
if (validOptions.length === 0) return null;
|
|
9640
|
+
const selected = new Set(
|
|
9641
|
+
result.selectedOptions?.map((o) => o.optionId) ?? []
|
|
9642
|
+
);
|
|
9643
|
+
if (selected.size === 0) return "NAO_RESPONDIDO" /* NAO_RESPONDIDO */;
|
|
9644
|
+
const validator = validators[result.questionType];
|
|
9645
|
+
if (!validator) return null;
|
|
9646
|
+
return validator(selected, validOptions);
|
|
9647
|
+
};
|
|
9610
9648
|
var getQuestionStatusFromData = (questionData) => {
|
|
9611
|
-
|
|
9649
|
+
const { result } = questionData;
|
|
9650
|
+
if (result.answerStatus === "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */ && canAutoValidate(questionData)) {
|
|
9651
|
+
const autoValidatedStatus = autoValidateQuestion(questionData);
|
|
9652
|
+
if (autoValidatedStatus !== null) {
|
|
9653
|
+
return mapAnswerStatusToQuestionStatus(autoValidatedStatus);
|
|
9654
|
+
}
|
|
9655
|
+
}
|
|
9656
|
+
return mapAnswerStatusToQuestionStatus(result.answerStatus);
|
|
9612
9657
|
};
|
|
9613
9658
|
|
|
9614
9659
|
// src/utils/studentActivityCorrection/converter.ts
|
|
@@ -9958,12 +10003,15 @@ var renderQuestionAlternative = ({
|
|
|
9958
10003
|
question,
|
|
9959
10004
|
result
|
|
9960
10005
|
}) => {
|
|
10006
|
+
const hasAutoValidation = result?.options?.some(
|
|
10007
|
+
(op) => op.isCorrect !== void 0 && op.isCorrect !== null
|
|
10008
|
+
);
|
|
9961
10009
|
const alternatives = question.options?.map((option) => {
|
|
9962
10010
|
const isCorrectOption = result?.options?.find((op) => op.id === option.id)?.isCorrect || false;
|
|
9963
10011
|
const isSelected = result?.selectedOptions?.some(
|
|
9964
10012
|
(selectedOption) => selectedOption.optionId === option.id
|
|
9965
10013
|
) || false;
|
|
9966
|
-
const shouldShowCorrectAnswers = result?.answerStatus !== "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO
|
|
10014
|
+
const shouldShowCorrectAnswers = result?.answerStatus !== "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */ || hasAutoValidation;
|
|
9967
10015
|
let status;
|
|
9968
10016
|
if (shouldShowCorrectAnswers) {
|
|
9969
10017
|
if (isCorrectOption) {
|
|
@@ -10137,12 +10185,15 @@ var renderQuestionMultipleChoice = ({
|
|
|
10137
10185
|
question,
|
|
10138
10186
|
result
|
|
10139
10187
|
}) => {
|
|
10188
|
+
const hasAutoValidation = result?.options?.some(
|
|
10189
|
+
(op) => op.isCorrect !== void 0 && op.isCorrect !== null
|
|
10190
|
+
);
|
|
10140
10191
|
const choices = question.options?.map((option) => {
|
|
10141
10192
|
const isCorrectOption = result?.options?.find((op) => op.id === option.id)?.isCorrect || false;
|
|
10142
10193
|
const isSelected = result?.selectedOptions?.some(
|
|
10143
10194
|
(op) => op.optionId === option.id
|
|
10144
10195
|
);
|
|
10145
|
-
const shouldShowCorrectAnswers = result?.answerStatus !== "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */ && result?.answerStatus !== "NAO_RESPONDIDO" /* NAO_RESPONDIDO
|
|
10196
|
+
const shouldShowCorrectAnswers = result?.answerStatus !== "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */ && result?.answerStatus !== "NAO_RESPONDIDO" /* NAO_RESPONDIDO */ || hasAutoValidation;
|
|
10146
10197
|
let status;
|
|
10147
10198
|
if (shouldShowCorrectAnswers) {
|
|
10148
10199
|
if (isCorrectOption) {
|
|
@@ -21698,11 +21749,7 @@ var ActivityDetails = ({
|
|
|
21698
21749
|
setIsViewOnlyModal(isViewOnly);
|
|
21699
21750
|
setCorrectionError(null);
|
|
21700
21751
|
try {
|
|
21701
|
-
const apiResponse = await fetchStudentCorrection(
|
|
21702
|
-
activityId,
|
|
21703
|
-
studentId,
|
|
21704
|
-
student.studentName || "Aluno"
|
|
21705
|
-
);
|
|
21752
|
+
const apiResponse = await fetchStudentCorrection(activityId, studentId);
|
|
21706
21753
|
const correction = convertApiResponseToCorrectionData(
|
|
21707
21754
|
apiResponse,
|
|
21708
21755
|
studentId,
|