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
|
@@ -5643,8 +5643,53 @@ var getQuestionStatusBadgeConfig = (status) => {
|
|
|
5643
5643
|
};
|
|
5644
5644
|
return configs[status] ?? defaultConfig;
|
|
5645
5645
|
};
|
|
5646
|
+
var canAutoValidate = (questionData) => {
|
|
5647
|
+
const { result } = questionData;
|
|
5648
|
+
if (result.questionType === "DISSERTATIVA" /* DISSERTATIVA */) {
|
|
5649
|
+
return false;
|
|
5650
|
+
}
|
|
5651
|
+
return true;
|
|
5652
|
+
};
|
|
5653
|
+
var hasIsCorrect = (op) => {
|
|
5654
|
+
return op.isCorrect != null;
|
|
5655
|
+
};
|
|
5656
|
+
var validateAlternativa = (selected, options) => {
|
|
5657
|
+
if (selected.size !== 1) return "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */;
|
|
5658
|
+
const [selectedId] = selected;
|
|
5659
|
+
return options.find((o) => o.id === selectedId)?.isCorrect ? "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */ : "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */;
|
|
5660
|
+
};
|
|
5661
|
+
var validateMultiplaEscolha = (selected, options) => {
|
|
5662
|
+
const allMatch = options.every((op) => selected.has(op.id) === op.isCorrect);
|
|
5663
|
+
return allMatch ? "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */ : "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */;
|
|
5664
|
+
};
|
|
5665
|
+
var validateVerdadeiroFalso = validateMultiplaEscolha;
|
|
5666
|
+
var validators = {
|
|
5667
|
+
["ALTERNATIVA" /* ALTERNATIVA */]: validateAlternativa,
|
|
5668
|
+
["MULTIPLA_ESCOLHA" /* MULTIPLA_ESCOLHA */]: validateMultiplaEscolha,
|
|
5669
|
+
["VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */]: validateVerdadeiroFalso
|
|
5670
|
+
};
|
|
5671
|
+
var autoValidateQuestion = (questionData) => {
|
|
5672
|
+
const { result } = questionData;
|
|
5673
|
+
if (!canAutoValidate(questionData) || !result.options) return null;
|
|
5674
|
+
const validOptions = result.options.filter(hasIsCorrect);
|
|
5675
|
+
if (validOptions.length === 0) return null;
|
|
5676
|
+
const selected = new Set(
|
|
5677
|
+
result.selectedOptions?.map((o) => o.optionId) ?? []
|
|
5678
|
+
);
|
|
5679
|
+
if (selected.size === 0) return "NAO_RESPONDIDO" /* NAO_RESPONDIDO */;
|
|
5680
|
+
const validator = validators[result.questionType];
|
|
5681
|
+
if (!validator) return null;
|
|
5682
|
+
return validator(selected, validOptions);
|
|
5683
|
+
};
|
|
5646
5684
|
var getQuestionStatusFromData = (questionData) => {
|
|
5647
|
-
|
|
5685
|
+
const { result } = questionData;
|
|
5686
|
+
if (result.answerStatus === "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */ && canAutoValidate(questionData)) {
|
|
5687
|
+
const autoValidatedStatus = autoValidateQuestion(questionData);
|
|
5688
|
+
if (autoValidatedStatus !== null) {
|
|
5689
|
+
return mapAnswerStatusToQuestionStatus(autoValidatedStatus);
|
|
5690
|
+
}
|
|
5691
|
+
}
|
|
5692
|
+
return mapAnswerStatusToQuestionStatus(result.answerStatus);
|
|
5648
5693
|
};
|
|
5649
5694
|
|
|
5650
5695
|
// src/utils/studentActivityCorrection/converter.ts
|
|
@@ -5994,12 +6039,15 @@ var renderQuestionAlternative = ({
|
|
|
5994
6039
|
question,
|
|
5995
6040
|
result
|
|
5996
6041
|
}) => {
|
|
6042
|
+
const hasAutoValidation = result?.options?.some(
|
|
6043
|
+
(op) => op.isCorrect !== void 0 && op.isCorrect !== null
|
|
6044
|
+
);
|
|
5997
6045
|
const alternatives = question.options?.map((option) => {
|
|
5998
6046
|
const isCorrectOption = result?.options?.find((op) => op.id === option.id)?.isCorrect || false;
|
|
5999
6047
|
const isSelected = result?.selectedOptions?.some(
|
|
6000
6048
|
(selectedOption) => selectedOption.optionId === option.id
|
|
6001
6049
|
) || false;
|
|
6002
|
-
const shouldShowCorrectAnswers = result?.answerStatus !== "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO
|
|
6050
|
+
const shouldShowCorrectAnswers = result?.answerStatus !== "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */ || hasAutoValidation;
|
|
6003
6051
|
let status;
|
|
6004
6052
|
if (shouldShowCorrectAnswers) {
|
|
6005
6053
|
if (isCorrectOption) {
|
|
@@ -6173,12 +6221,15 @@ var renderQuestionMultipleChoice = ({
|
|
|
6173
6221
|
question,
|
|
6174
6222
|
result
|
|
6175
6223
|
}) => {
|
|
6224
|
+
const hasAutoValidation = result?.options?.some(
|
|
6225
|
+
(op) => op.isCorrect !== void 0 && op.isCorrect !== null
|
|
6226
|
+
);
|
|
6176
6227
|
const choices = question.options?.map((option) => {
|
|
6177
6228
|
const isCorrectOption = result?.options?.find((op) => op.id === option.id)?.isCorrect || false;
|
|
6178
6229
|
const isSelected = result?.selectedOptions?.some(
|
|
6179
6230
|
(op) => op.optionId === option.id
|
|
6180
6231
|
);
|
|
6181
|
-
const shouldShowCorrectAnswers = result?.answerStatus !== "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */ && result?.answerStatus !== "NAO_RESPONDIDO" /* NAO_RESPONDIDO
|
|
6232
|
+
const shouldShowCorrectAnswers = result?.answerStatus !== "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */ && result?.answerStatus !== "NAO_RESPONDIDO" /* NAO_RESPONDIDO */ || hasAutoValidation;
|
|
6182
6233
|
let status;
|
|
6183
6234
|
if (shouldShowCorrectAnswers) {
|
|
6184
6235
|
if (isCorrectOption) {
|
|
@@ -8724,11 +8775,7 @@ var ActivityDetails = ({
|
|
|
8724
8775
|
setIsViewOnlyModal(isViewOnly);
|
|
8725
8776
|
setCorrectionError(null);
|
|
8726
8777
|
try {
|
|
8727
|
-
const apiResponse = await fetchStudentCorrection(
|
|
8728
|
-
activityId,
|
|
8729
|
-
studentId,
|
|
8730
|
-
student.studentName || "Aluno"
|
|
8731
|
-
);
|
|
8778
|
+
const apiResponse = await fetchStudentCorrection(activityId, studentId);
|
|
8732
8779
|
const correction = convertApiResponseToCorrectionData(
|
|
8733
8780
|
apiResponse,
|
|
8734
8781
|
studentId,
|