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
|
@@ -10,7 +10,7 @@ export interface ActivityDetailsProps {
|
|
|
10
10
|
/** Function to fetch activity details. Must be memoized (using useCallback) to prevent re-fetches on every render. */
|
|
11
11
|
fetchActivityDetails: (id: string, params?: ActivityDetailsQueryParams) => Promise<ActivityDetailsData>;
|
|
12
12
|
/** Function to fetch student correction data from API (fetchQuestionsAnswersByStudent) */
|
|
13
|
-
fetchStudentCorrection: (activityId: string, studentId: string
|
|
13
|
+
fetchStudentCorrection: (activityId: string, studentId: string) => Promise<QuestionsAnswersByStudentResponse>;
|
|
14
14
|
/** Function to submit observation */
|
|
15
15
|
submitObservation: (activityId: string, studentId: string, observation: string, files: File[]) => Promise<void>;
|
|
16
16
|
/** Function to submit question correction (for essay questions) */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActivityDetails.d.ts","sourceRoot":"","sources":["../../../src/components/ActivityDetails/ActivityDetails.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,EAEV,6BAA6B,EAC7B,iCAAiC,EAClC,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAGhC,MAAM,6BAA6B,CAAC;AAQrC;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,yCAAyC;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,sHAAsH;IACtH,oBAAoB,EAAE,CACpB,EAAE,EAAE,MAAM,EACV,MAAM,CAAC,EAAE,0BAA0B,KAChC,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAClC,0FAA0F;IAC1F,sBAAsB,EAAE,CACtB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"ActivityDetails.d.ts","sourceRoot":"","sources":["../../../src/components/ActivityDetails/ActivityDetails.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,EAEV,6BAA6B,EAC7B,iCAAiC,EAClC,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAGhC,MAAM,6BAA6B,CAAC;AAQrC;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,yCAAyC;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,sHAAsH;IACtH,oBAAoB,EAAE,CACpB,EAAE,EAAE,MAAM,EACV,MAAM,CAAC,EAAE,0BAA0B,KAChC,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAClC,0FAA0F;IAC1F,sBAAsB,EAAE,CACtB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,KACd,OAAO,CAAC,iCAAiC,CAAC,CAAC;IAChD,qCAAqC;IACrC,iBAAiB,EAAE,CACjB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,IAAI,EAAE,KACV,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,mEAAmE;IACnE,wBAAwB,CAAC,EAAE,CACzB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,6BAA6B,KACnC,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,oDAAoD;IACpD,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,4BAA4B;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kDAAkD;IAClD,oBAAoB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,WAAW,GAAG,IAAI,CAAC;CACpE;AA2HD;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,2KAU7B,oBAAoB,4CA2ftB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -5588,8 +5588,53 @@ var getQuestionStatusBadgeConfig = (status) => {
|
|
|
5588
5588
|
};
|
|
5589
5589
|
return configs[status] ?? defaultConfig;
|
|
5590
5590
|
};
|
|
5591
|
+
var canAutoValidate = (questionData) => {
|
|
5592
|
+
const { result } = questionData;
|
|
5593
|
+
if (result.questionType === "DISSERTATIVA" /* DISSERTATIVA */) {
|
|
5594
|
+
return false;
|
|
5595
|
+
}
|
|
5596
|
+
return true;
|
|
5597
|
+
};
|
|
5598
|
+
var hasIsCorrect = (op) => {
|
|
5599
|
+
return op.isCorrect != null;
|
|
5600
|
+
};
|
|
5601
|
+
var validateAlternativa = (selected, options) => {
|
|
5602
|
+
if (selected.size !== 1) return "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */;
|
|
5603
|
+
const [selectedId] = selected;
|
|
5604
|
+
return options.find((o) => o.id === selectedId)?.isCorrect ? "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */ : "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */;
|
|
5605
|
+
};
|
|
5606
|
+
var validateMultiplaEscolha = (selected, options) => {
|
|
5607
|
+
const allMatch = options.every((op) => selected.has(op.id) === op.isCorrect);
|
|
5608
|
+
return allMatch ? "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */ : "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */;
|
|
5609
|
+
};
|
|
5610
|
+
var validateVerdadeiroFalso = validateMultiplaEscolha;
|
|
5611
|
+
var validators = {
|
|
5612
|
+
["ALTERNATIVA" /* ALTERNATIVA */]: validateAlternativa,
|
|
5613
|
+
["MULTIPLA_ESCOLHA" /* MULTIPLA_ESCOLHA */]: validateMultiplaEscolha,
|
|
5614
|
+
["VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */]: validateVerdadeiroFalso
|
|
5615
|
+
};
|
|
5616
|
+
var autoValidateQuestion = (questionData) => {
|
|
5617
|
+
const { result } = questionData;
|
|
5618
|
+
if (!canAutoValidate(questionData) || !result.options) return null;
|
|
5619
|
+
const validOptions = result.options.filter(hasIsCorrect);
|
|
5620
|
+
if (validOptions.length === 0) return null;
|
|
5621
|
+
const selected = new Set(
|
|
5622
|
+
result.selectedOptions?.map((o) => o.optionId) ?? []
|
|
5623
|
+
);
|
|
5624
|
+
if (selected.size === 0) return "NAO_RESPONDIDO" /* NAO_RESPONDIDO */;
|
|
5625
|
+
const validator = validators[result.questionType];
|
|
5626
|
+
if (!validator) return null;
|
|
5627
|
+
return validator(selected, validOptions);
|
|
5628
|
+
};
|
|
5591
5629
|
var getQuestionStatusFromData = (questionData) => {
|
|
5592
|
-
|
|
5630
|
+
const { result } = questionData;
|
|
5631
|
+
if (result.answerStatus === "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */ && canAutoValidate(questionData)) {
|
|
5632
|
+
const autoValidatedStatus = autoValidateQuestion(questionData);
|
|
5633
|
+
if (autoValidatedStatus !== null) {
|
|
5634
|
+
return mapAnswerStatusToQuestionStatus(autoValidatedStatus);
|
|
5635
|
+
}
|
|
5636
|
+
}
|
|
5637
|
+
return mapAnswerStatusToQuestionStatus(result.answerStatus);
|
|
5593
5638
|
};
|
|
5594
5639
|
|
|
5595
5640
|
// src/utils/studentActivityCorrection/converter.ts
|
|
@@ -5939,12 +5984,15 @@ var renderQuestionAlternative = ({
|
|
|
5939
5984
|
question,
|
|
5940
5985
|
result
|
|
5941
5986
|
}) => {
|
|
5987
|
+
const hasAutoValidation = result?.options?.some(
|
|
5988
|
+
(op) => op.isCorrect !== void 0 && op.isCorrect !== null
|
|
5989
|
+
);
|
|
5942
5990
|
const alternatives = question.options?.map((option) => {
|
|
5943
5991
|
const isCorrectOption = result?.options?.find((op) => op.id === option.id)?.isCorrect || false;
|
|
5944
5992
|
const isSelected = result?.selectedOptions?.some(
|
|
5945
5993
|
(selectedOption) => selectedOption.optionId === option.id
|
|
5946
5994
|
) || false;
|
|
5947
|
-
const shouldShowCorrectAnswers = result?.answerStatus !== "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO
|
|
5995
|
+
const shouldShowCorrectAnswers = result?.answerStatus !== "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */ || hasAutoValidation;
|
|
5948
5996
|
let status;
|
|
5949
5997
|
if (shouldShowCorrectAnswers) {
|
|
5950
5998
|
if (isCorrectOption) {
|
|
@@ -6118,12 +6166,15 @@ var renderQuestionMultipleChoice = ({
|
|
|
6118
6166
|
question,
|
|
6119
6167
|
result
|
|
6120
6168
|
}) => {
|
|
6169
|
+
const hasAutoValidation = result?.options?.some(
|
|
6170
|
+
(op) => op.isCorrect !== void 0 && op.isCorrect !== null
|
|
6171
|
+
);
|
|
6121
6172
|
const choices = question.options?.map((option) => {
|
|
6122
6173
|
const isCorrectOption = result?.options?.find((op) => op.id === option.id)?.isCorrect || false;
|
|
6123
6174
|
const isSelected = result?.selectedOptions?.some(
|
|
6124
6175
|
(op) => op.optionId === option.id
|
|
6125
6176
|
);
|
|
6126
|
-
const shouldShowCorrectAnswers = result?.answerStatus !== "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */ && result?.answerStatus !== "NAO_RESPONDIDO" /* NAO_RESPONDIDO
|
|
6177
|
+
const shouldShowCorrectAnswers = result?.answerStatus !== "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */ && result?.answerStatus !== "NAO_RESPONDIDO" /* NAO_RESPONDIDO */ || hasAutoValidation;
|
|
6127
6178
|
let status;
|
|
6128
6179
|
if (shouldShowCorrectAnswers) {
|
|
6129
6180
|
if (isCorrectOption) {
|
|
@@ -8649,11 +8700,7 @@ var ActivityDetails = ({
|
|
|
8649
8700
|
setIsViewOnlyModal(isViewOnly);
|
|
8650
8701
|
setCorrectionError(null);
|
|
8651
8702
|
try {
|
|
8652
|
-
const apiResponse = await fetchStudentCorrection(
|
|
8653
|
-
activityId,
|
|
8654
|
-
studentId,
|
|
8655
|
-
student.studentName || "Aluno"
|
|
8656
|
-
);
|
|
8703
|
+
const apiResponse = await fetchStudentCorrection(activityId, studentId);
|
|
8657
8704
|
const correction = convertApiResponseToCorrectionData(
|
|
8658
8705
|
apiResponse,
|
|
8659
8706
|
studentId,
|