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
|
@@ -3261,8 +3261,53 @@ var getQuestionStatusBadgeConfig = (status) => {
|
|
|
3261
3261
|
};
|
|
3262
3262
|
return configs[status] ?? defaultConfig;
|
|
3263
3263
|
};
|
|
3264
|
+
var canAutoValidate = (questionData) => {
|
|
3265
|
+
const { result } = questionData;
|
|
3266
|
+
if (result.questionType === "DISSERTATIVA" /* DISSERTATIVA */) {
|
|
3267
|
+
return false;
|
|
3268
|
+
}
|
|
3269
|
+
return true;
|
|
3270
|
+
};
|
|
3271
|
+
var hasIsCorrect = (op) => {
|
|
3272
|
+
return op.isCorrect != null;
|
|
3273
|
+
};
|
|
3274
|
+
var validateAlternativa = (selected, options) => {
|
|
3275
|
+
if (selected.size !== 1) return "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */;
|
|
3276
|
+
const [selectedId] = selected;
|
|
3277
|
+
return options.find((o) => o.id === selectedId)?.isCorrect ? "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */ : "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */;
|
|
3278
|
+
};
|
|
3279
|
+
var validateMultiplaEscolha = (selected, options) => {
|
|
3280
|
+
const allMatch = options.every((op) => selected.has(op.id) === op.isCorrect);
|
|
3281
|
+
return allMatch ? "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */ : "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */;
|
|
3282
|
+
};
|
|
3283
|
+
var validateVerdadeiroFalso = validateMultiplaEscolha;
|
|
3284
|
+
var validators = {
|
|
3285
|
+
["ALTERNATIVA" /* ALTERNATIVA */]: validateAlternativa,
|
|
3286
|
+
["MULTIPLA_ESCOLHA" /* MULTIPLA_ESCOLHA */]: validateMultiplaEscolha,
|
|
3287
|
+
["VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */]: validateVerdadeiroFalso
|
|
3288
|
+
};
|
|
3289
|
+
var autoValidateQuestion = (questionData) => {
|
|
3290
|
+
const { result } = questionData;
|
|
3291
|
+
if (!canAutoValidate(questionData) || !result.options) return null;
|
|
3292
|
+
const validOptions = result.options.filter(hasIsCorrect);
|
|
3293
|
+
if (validOptions.length === 0) return null;
|
|
3294
|
+
const selected = new Set(
|
|
3295
|
+
result.selectedOptions?.map((o) => o.optionId) ?? []
|
|
3296
|
+
);
|
|
3297
|
+
if (selected.size === 0) return "NAO_RESPONDIDO" /* NAO_RESPONDIDO */;
|
|
3298
|
+
const validator = validators[result.questionType];
|
|
3299
|
+
if (!validator) return null;
|
|
3300
|
+
return validator(selected, validOptions);
|
|
3301
|
+
};
|
|
3264
3302
|
var getQuestionStatusFromData = (questionData) => {
|
|
3265
|
-
|
|
3303
|
+
const { result } = questionData;
|
|
3304
|
+
if (result.answerStatus === "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */ && canAutoValidate(questionData)) {
|
|
3305
|
+
const autoValidatedStatus = autoValidateQuestion(questionData);
|
|
3306
|
+
if (autoValidatedStatus !== null) {
|
|
3307
|
+
return mapAnswerStatusToQuestionStatus(autoValidatedStatus);
|
|
3308
|
+
}
|
|
3309
|
+
}
|
|
3310
|
+
return mapAnswerStatusToQuestionStatus(result.answerStatus);
|
|
3266
3311
|
};
|
|
3267
3312
|
|
|
3268
3313
|
// src/components/Alternative/Alternative.tsx
|
|
@@ -3531,12 +3576,15 @@ var renderQuestionAlternative = ({
|
|
|
3531
3576
|
question,
|
|
3532
3577
|
result
|
|
3533
3578
|
}) => {
|
|
3579
|
+
const hasAutoValidation = result?.options?.some(
|
|
3580
|
+
(op) => op.isCorrect !== void 0 && op.isCorrect !== null
|
|
3581
|
+
);
|
|
3534
3582
|
const alternatives = question.options?.map((option) => {
|
|
3535
3583
|
const isCorrectOption = result?.options?.find((op) => op.id === option.id)?.isCorrect || false;
|
|
3536
3584
|
const isSelected = result?.selectedOptions?.some(
|
|
3537
3585
|
(selectedOption) => selectedOption.optionId === option.id
|
|
3538
3586
|
) || false;
|
|
3539
|
-
const shouldShowCorrectAnswers = result?.answerStatus !== "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO
|
|
3587
|
+
const shouldShowCorrectAnswers = result?.answerStatus !== "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */ || hasAutoValidation;
|
|
3540
3588
|
let status;
|
|
3541
3589
|
if (shouldShowCorrectAnswers) {
|
|
3542
3590
|
if (isCorrectOption) {
|
|
@@ -4051,12 +4099,15 @@ var renderQuestionMultipleChoice = ({
|
|
|
4051
4099
|
question,
|
|
4052
4100
|
result
|
|
4053
4101
|
}) => {
|
|
4102
|
+
const hasAutoValidation = result?.options?.some(
|
|
4103
|
+
(op) => op.isCorrect !== void 0 && op.isCorrect !== null
|
|
4104
|
+
);
|
|
4054
4105
|
const choices = question.options?.map((option) => {
|
|
4055
4106
|
const isCorrectOption = result?.options?.find((op) => op.id === option.id)?.isCorrect || false;
|
|
4056
4107
|
const isSelected = result?.selectedOptions?.some(
|
|
4057
4108
|
(op) => op.optionId === option.id
|
|
4058
4109
|
);
|
|
4059
|
-
const shouldShowCorrectAnswers = result?.answerStatus !== "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */ && result?.answerStatus !== "NAO_RESPONDIDO" /* NAO_RESPONDIDO
|
|
4110
|
+
const shouldShowCorrectAnswers = result?.answerStatus !== "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */ && result?.answerStatus !== "NAO_RESPONDIDO" /* NAO_RESPONDIDO */ || hasAutoValidation;
|
|
4060
4111
|
let status;
|
|
4061
4112
|
if (shouldShowCorrectAnswers) {
|
|
4062
4113
|
if (isCorrectOption) {
|