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
|
@@ -3282,8 +3282,53 @@ var getQuestionStatusBadgeConfig = (status) => {
|
|
|
3282
3282
|
};
|
|
3283
3283
|
return configs[status] ?? defaultConfig;
|
|
3284
3284
|
};
|
|
3285
|
+
var canAutoValidate = (questionData) => {
|
|
3286
|
+
const { result } = questionData;
|
|
3287
|
+
if (result.questionType === "DISSERTATIVA" /* DISSERTATIVA */) {
|
|
3288
|
+
return false;
|
|
3289
|
+
}
|
|
3290
|
+
return true;
|
|
3291
|
+
};
|
|
3292
|
+
var hasIsCorrect = (op) => {
|
|
3293
|
+
return op.isCorrect != null;
|
|
3294
|
+
};
|
|
3295
|
+
var validateAlternativa = (selected, options) => {
|
|
3296
|
+
if (selected.size !== 1) return "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */;
|
|
3297
|
+
const [selectedId] = selected;
|
|
3298
|
+
return options.find((o) => o.id === selectedId)?.isCorrect ? "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */ : "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */;
|
|
3299
|
+
};
|
|
3300
|
+
var validateMultiplaEscolha = (selected, options) => {
|
|
3301
|
+
const allMatch = options.every((op) => selected.has(op.id) === op.isCorrect);
|
|
3302
|
+
return allMatch ? "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */ : "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */;
|
|
3303
|
+
};
|
|
3304
|
+
var validateVerdadeiroFalso = validateMultiplaEscolha;
|
|
3305
|
+
var validators = {
|
|
3306
|
+
["ALTERNATIVA" /* ALTERNATIVA */]: validateAlternativa,
|
|
3307
|
+
["MULTIPLA_ESCOLHA" /* MULTIPLA_ESCOLHA */]: validateMultiplaEscolha,
|
|
3308
|
+
["VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */]: validateVerdadeiroFalso
|
|
3309
|
+
};
|
|
3310
|
+
var autoValidateQuestion = (questionData) => {
|
|
3311
|
+
const { result } = questionData;
|
|
3312
|
+
if (!canAutoValidate(questionData) || !result.options) return null;
|
|
3313
|
+
const validOptions = result.options.filter(hasIsCorrect);
|
|
3314
|
+
if (validOptions.length === 0) return null;
|
|
3315
|
+
const selected = new Set(
|
|
3316
|
+
result.selectedOptions?.map((o) => o.optionId) ?? []
|
|
3317
|
+
);
|
|
3318
|
+
if (selected.size === 0) return "NAO_RESPONDIDO" /* NAO_RESPONDIDO */;
|
|
3319
|
+
const validator = validators[result.questionType];
|
|
3320
|
+
if (!validator) return null;
|
|
3321
|
+
return validator(selected, validOptions);
|
|
3322
|
+
};
|
|
3285
3323
|
var getQuestionStatusFromData = (questionData) => {
|
|
3286
|
-
|
|
3324
|
+
const { result } = questionData;
|
|
3325
|
+
if (result.answerStatus === "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */ && canAutoValidate(questionData)) {
|
|
3326
|
+
const autoValidatedStatus = autoValidateQuestion(questionData);
|
|
3327
|
+
if (autoValidatedStatus !== null) {
|
|
3328
|
+
return mapAnswerStatusToQuestionStatus(autoValidatedStatus);
|
|
3329
|
+
}
|
|
3330
|
+
}
|
|
3331
|
+
return mapAnswerStatusToQuestionStatus(result.answerStatus);
|
|
3287
3332
|
};
|
|
3288
3333
|
|
|
3289
3334
|
// src/components/Alternative/Alternative.tsx
|
|
@@ -3552,12 +3597,15 @@ var renderQuestionAlternative = ({
|
|
|
3552
3597
|
question,
|
|
3553
3598
|
result
|
|
3554
3599
|
}) => {
|
|
3600
|
+
const hasAutoValidation = result?.options?.some(
|
|
3601
|
+
(op) => op.isCorrect !== void 0 && op.isCorrect !== null
|
|
3602
|
+
);
|
|
3555
3603
|
const alternatives = question.options?.map((option) => {
|
|
3556
3604
|
const isCorrectOption = result?.options?.find((op) => op.id === option.id)?.isCorrect || false;
|
|
3557
3605
|
const isSelected = result?.selectedOptions?.some(
|
|
3558
3606
|
(selectedOption) => selectedOption.optionId === option.id
|
|
3559
3607
|
) || false;
|
|
3560
|
-
const shouldShowCorrectAnswers = result?.answerStatus !== "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO
|
|
3608
|
+
const shouldShowCorrectAnswers = result?.answerStatus !== "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */ || hasAutoValidation;
|
|
3561
3609
|
let status;
|
|
3562
3610
|
if (shouldShowCorrectAnswers) {
|
|
3563
3611
|
if (isCorrectOption) {
|
|
@@ -4084,12 +4132,15 @@ var renderQuestionMultipleChoice = ({
|
|
|
4084
4132
|
question,
|
|
4085
4133
|
result
|
|
4086
4134
|
}) => {
|
|
4135
|
+
const hasAutoValidation = result?.options?.some(
|
|
4136
|
+
(op) => op.isCorrect !== void 0 && op.isCorrect !== null
|
|
4137
|
+
);
|
|
4087
4138
|
const choices = question.options?.map((option) => {
|
|
4088
4139
|
const isCorrectOption = result?.options?.find((op) => op.id === option.id)?.isCorrect || false;
|
|
4089
4140
|
const isSelected = result?.selectedOptions?.some(
|
|
4090
4141
|
(op) => op.optionId === option.id
|
|
4091
4142
|
);
|
|
4092
|
-
const shouldShowCorrectAnswers = result?.answerStatus !== "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */ && result?.answerStatus !== "NAO_RESPONDIDO" /* NAO_RESPONDIDO
|
|
4143
|
+
const shouldShowCorrectAnswers = result?.answerStatus !== "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */ && result?.answerStatus !== "NAO_RESPONDIDO" /* NAO_RESPONDIDO */ || hasAutoValidation;
|
|
4093
4144
|
let status;
|
|
4094
4145
|
if (shouldShowCorrectAnswers) {
|
|
4095
4146
|
if (isCorrectOption) {
|