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.js
CHANGED
|
@@ -9830,8 +9830,53 @@ var getQuestionStatusBadgeConfig = (status) => {
|
|
|
9830
9830
|
};
|
|
9831
9831
|
return configs[status] ?? defaultConfig;
|
|
9832
9832
|
};
|
|
9833
|
+
var canAutoValidate = (questionData) => {
|
|
9834
|
+
const { result } = questionData;
|
|
9835
|
+
if (result.questionType === "DISSERTATIVA" /* DISSERTATIVA */) {
|
|
9836
|
+
return false;
|
|
9837
|
+
}
|
|
9838
|
+
return true;
|
|
9839
|
+
};
|
|
9840
|
+
var hasIsCorrect = (op) => {
|
|
9841
|
+
return op.isCorrect != null;
|
|
9842
|
+
};
|
|
9843
|
+
var validateAlternativa = (selected, options) => {
|
|
9844
|
+
if (selected.size !== 1) return "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */;
|
|
9845
|
+
const [selectedId] = selected;
|
|
9846
|
+
return options.find((o) => o.id === selectedId)?.isCorrect ? "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */ : "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */;
|
|
9847
|
+
};
|
|
9848
|
+
var validateMultiplaEscolha = (selected, options) => {
|
|
9849
|
+
const allMatch = options.every((op) => selected.has(op.id) === op.isCorrect);
|
|
9850
|
+
return allMatch ? "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */ : "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */;
|
|
9851
|
+
};
|
|
9852
|
+
var validateVerdadeiroFalso = validateMultiplaEscolha;
|
|
9853
|
+
var validators = {
|
|
9854
|
+
["ALTERNATIVA" /* ALTERNATIVA */]: validateAlternativa,
|
|
9855
|
+
["MULTIPLA_ESCOLHA" /* MULTIPLA_ESCOLHA */]: validateMultiplaEscolha,
|
|
9856
|
+
["VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */]: validateVerdadeiroFalso
|
|
9857
|
+
};
|
|
9858
|
+
var autoValidateQuestion = (questionData) => {
|
|
9859
|
+
const { result } = questionData;
|
|
9860
|
+
if (!canAutoValidate(questionData) || !result.options) return null;
|
|
9861
|
+
const validOptions = result.options.filter(hasIsCorrect);
|
|
9862
|
+
if (validOptions.length === 0) return null;
|
|
9863
|
+
const selected = new Set(
|
|
9864
|
+
result.selectedOptions?.map((o) => o.optionId) ?? []
|
|
9865
|
+
);
|
|
9866
|
+
if (selected.size === 0) return "NAO_RESPONDIDO" /* NAO_RESPONDIDO */;
|
|
9867
|
+
const validator = validators[result.questionType];
|
|
9868
|
+
if (!validator) return null;
|
|
9869
|
+
return validator(selected, validOptions);
|
|
9870
|
+
};
|
|
9833
9871
|
var getQuestionStatusFromData = (questionData) => {
|
|
9834
|
-
|
|
9872
|
+
const { result } = questionData;
|
|
9873
|
+
if (result.answerStatus === "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */ && canAutoValidate(questionData)) {
|
|
9874
|
+
const autoValidatedStatus = autoValidateQuestion(questionData);
|
|
9875
|
+
if (autoValidatedStatus !== null) {
|
|
9876
|
+
return mapAnswerStatusToQuestionStatus(autoValidatedStatus);
|
|
9877
|
+
}
|
|
9878
|
+
}
|
|
9879
|
+
return mapAnswerStatusToQuestionStatus(result.answerStatus);
|
|
9835
9880
|
};
|
|
9836
9881
|
|
|
9837
9882
|
// src/utils/studentActivityCorrection/converter.ts
|
|
@@ -10181,12 +10226,15 @@ var renderQuestionAlternative = ({
|
|
|
10181
10226
|
question,
|
|
10182
10227
|
result
|
|
10183
10228
|
}) => {
|
|
10229
|
+
const hasAutoValidation = result?.options?.some(
|
|
10230
|
+
(op) => op.isCorrect !== void 0 && op.isCorrect !== null
|
|
10231
|
+
);
|
|
10184
10232
|
const alternatives = question.options?.map((option) => {
|
|
10185
10233
|
const isCorrectOption = result?.options?.find((op) => op.id === option.id)?.isCorrect || false;
|
|
10186
10234
|
const isSelected = result?.selectedOptions?.some(
|
|
10187
10235
|
(selectedOption) => selectedOption.optionId === option.id
|
|
10188
10236
|
) || false;
|
|
10189
|
-
const shouldShowCorrectAnswers = result?.answerStatus !== "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO
|
|
10237
|
+
const shouldShowCorrectAnswers = result?.answerStatus !== "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */ || hasAutoValidation;
|
|
10190
10238
|
let status;
|
|
10191
10239
|
if (shouldShowCorrectAnswers) {
|
|
10192
10240
|
if (isCorrectOption) {
|
|
@@ -10360,12 +10408,15 @@ var renderQuestionMultipleChoice = ({
|
|
|
10360
10408
|
question,
|
|
10361
10409
|
result
|
|
10362
10410
|
}) => {
|
|
10411
|
+
const hasAutoValidation = result?.options?.some(
|
|
10412
|
+
(op) => op.isCorrect !== void 0 && op.isCorrect !== null
|
|
10413
|
+
);
|
|
10363
10414
|
const choices = question.options?.map((option) => {
|
|
10364
10415
|
const isCorrectOption = result?.options?.find((op) => op.id === option.id)?.isCorrect || false;
|
|
10365
10416
|
const isSelected = result?.selectedOptions?.some(
|
|
10366
10417
|
(op) => op.optionId === option.id
|
|
10367
10418
|
);
|
|
10368
|
-
const shouldShowCorrectAnswers = result?.answerStatus !== "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */ && result?.answerStatus !== "NAO_RESPONDIDO" /* NAO_RESPONDIDO
|
|
10419
|
+
const shouldShowCorrectAnswers = result?.answerStatus !== "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */ && result?.answerStatus !== "NAO_RESPONDIDO" /* NAO_RESPONDIDO */ || hasAutoValidation;
|
|
10369
10420
|
let status;
|
|
10370
10421
|
if (shouldShowCorrectAnswers) {
|
|
10371
10422
|
if (isCorrectOption) {
|
|
@@ -21851,11 +21902,7 @@ var ActivityDetails = ({
|
|
|
21851
21902
|
setIsViewOnlyModal(isViewOnly);
|
|
21852
21903
|
setCorrectionError(null);
|
|
21853
21904
|
try {
|
|
21854
|
-
const apiResponse = await fetchStudentCorrection(
|
|
21855
|
-
activityId,
|
|
21856
|
-
studentId,
|
|
21857
|
-
student.studentName || "Aluno"
|
|
21858
|
-
);
|
|
21905
|
+
const apiResponse = await fetchStudentCorrection(activityId, studentId);
|
|
21859
21906
|
const correction = convertApiResponseToCorrectionData(
|
|
21860
21907
|
apiResponse,
|
|
21861
21908
|
studentId,
|