l-min-components 1.7.1571 → 1.7.1572
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/package.json
CHANGED
|
@@ -425,6 +425,25 @@ const setupAnalysis = (data, audioData, score) => {
|
|
|
425
425
|
};
|
|
426
426
|
};
|
|
427
427
|
|
|
428
|
+
const quizWrittenSelectedModel = (response, aiData) => {
|
|
429
|
+
if (!response || !aiData) return null;
|
|
430
|
+
const index = response?.index || 0;
|
|
431
|
+
const objectData = {};
|
|
432
|
+
|
|
433
|
+
if (aiData?.grammar?.[index] && aiData?.grammar?.length) {
|
|
434
|
+
const findData = aiData?.grammar?.[index];
|
|
435
|
+
objectData["grammar"] = [findData];
|
|
436
|
+
}
|
|
437
|
+
if (
|
|
438
|
+
aiData?.comprehension?.length &&
|
|
439
|
+
aiData?.comprehension?.[0] &&
|
|
440
|
+
index === 0
|
|
441
|
+
) {
|
|
442
|
+
objectData["comprehension"] = aiData?.comprehension;
|
|
443
|
+
}
|
|
444
|
+
return objectData;
|
|
445
|
+
};
|
|
446
|
+
|
|
428
447
|
const quixSelectedModel = (response, aiData) => {
|
|
429
448
|
if (!response || !aiData) return null;
|
|
430
449
|
|
|
@@ -447,6 +466,13 @@ const quixSelectedModel = (response, aiData) => {
|
|
|
447
466
|
);
|
|
448
467
|
objectData["grammar"] = [findData];
|
|
449
468
|
}
|
|
469
|
+
if (aiData?.comprehension?.length && aiData?.comprehension) {
|
|
470
|
+
const attemptResp = aiData?.comprehension?.[0]?.attempt_data_batch?.[0];
|
|
471
|
+
|
|
472
|
+
if (attemptResp?.recording?.id === audioId || attemptResp?.id === audioId) {
|
|
473
|
+
objectData["comprehension"] = aiData?.comprehension;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
450
476
|
|
|
451
477
|
return objectData;
|
|
452
478
|
};
|
|
@@ -692,10 +718,15 @@ const getQuestionInfo = (question) => {
|
|
|
692
718
|
type = "word-play-multiple-choice";
|
|
693
719
|
else type = "word-play-text";
|
|
694
720
|
} else if (question?.type === "QUIZ") {
|
|
695
|
-
if (
|
|
721
|
+
if (
|
|
722
|
+
question?.question_data?.question_data?.type === "MultipleChoice" ||
|
|
723
|
+
question?.question_data?.question_data?.type === "Multiple Choice"
|
|
724
|
+
)
|
|
696
725
|
type = "quiz-multiple-choice";
|
|
697
726
|
else if (question?.question_data?.question_data?.type === "UnScripted")
|
|
698
727
|
type = "quiz-unscripted";
|
|
728
|
+
else if (question?.question_data?.question_data?.type === "Written")
|
|
729
|
+
type = "quiz-written";
|
|
699
730
|
else type = "quiz-scripted";
|
|
700
731
|
} else if (question?.type === "ESSAY") {
|
|
701
732
|
if (question?.question_data?.config?.type === "Scripted")
|
|
@@ -729,6 +760,7 @@ const useReportUtils = () => {
|
|
|
729
760
|
grammarFindOperation,
|
|
730
761
|
toRGBA,
|
|
731
762
|
getQuestionInfo,
|
|
763
|
+
quizWrittenSelectedModel,
|
|
732
764
|
};
|
|
733
765
|
};
|
|
734
766
|
|
|
@@ -62,6 +62,7 @@ import { NavBack, NavForword } from "../fullAnalysis/icons/navArrow";
|
|
|
62
62
|
*/
|
|
63
63
|
import useTranslation from "../../../hooks/useTranslation.jsx";
|
|
64
64
|
import wordStore from "../../../mc/wordStore.json";
|
|
65
|
+
import QuizWritten from "./questions/quizWritten.jsx";
|
|
65
66
|
const ReportQuestions = ({
|
|
66
67
|
accountType,
|
|
67
68
|
AiData,
|
|
@@ -385,6 +386,17 @@ const ReportQuestions = ({
|
|
|
385
386
|
defaultSelected={defaultSelected}
|
|
386
387
|
/>
|
|
387
388
|
)}
|
|
389
|
+
|
|
390
|
+
{questionType === "quiz-written" && (
|
|
391
|
+
<QuizWritten
|
|
392
|
+
data={findedQuestion}
|
|
393
|
+
answerData={answerData}
|
|
394
|
+
aiData={AiData}
|
|
395
|
+
setToggle={setToggle}
|
|
396
|
+
isPersonal={isPersonal}
|
|
397
|
+
defaultSelected={defaultSelected}
|
|
398
|
+
/>
|
|
399
|
+
)}
|
|
388
400
|
{questionType === "quiz-multiple-choice" && (
|
|
389
401
|
<QuizMultipleChoice
|
|
390
402
|
data={findedQuestion}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
import {
|
|
3
|
+
QuestionSection,
|
|
4
|
+
QuestionSectionAction,
|
|
5
|
+
QuestionSectionWithAnalysis,
|
|
6
|
+
} from "../style.jsx";
|
|
7
|
+
import Tabs from "../components/tabs.jsx";
|
|
8
|
+
import useReportUtils from "../../hooks/useRreportUtils.jsx";
|
|
9
|
+
import Response from "../components/response.jsx";
|
|
10
|
+
import AnalysisButton from "../components/analysisButton.jsx";
|
|
11
|
+
import QuestionDropdown from "../components/questionDropdown.jsx";
|
|
12
|
+
import QuizQuestion from "../components/quizQuestion.jsx";
|
|
13
|
+
|
|
14
|
+
import useTranslation from "../../../../hooks/useTranslation.jsx";
|
|
15
|
+
import wordStore from "../../../../mc/wordStore.json";
|
|
16
|
+
const QuizWritten = ({
|
|
17
|
+
data,
|
|
18
|
+
aiData,
|
|
19
|
+
setToggle,
|
|
20
|
+
answerData,
|
|
21
|
+
isPersonal,
|
|
22
|
+
defaultSelected = 1,
|
|
23
|
+
}) => {
|
|
24
|
+
const { findText } = useTranslation(wordStore);
|
|
25
|
+
const [selected, setSelected] = useState(defaultSelected);
|
|
26
|
+
const [analysis, setAnalysis] = useState(null);
|
|
27
|
+
const { quizResponses, setupAnalysis, quizWrittenSelectedModel } =
|
|
28
|
+
useReportUtils();
|
|
29
|
+
const quizList = quizResponses({
|
|
30
|
+
responses: answerData?.answer?.data?.data?.responses,
|
|
31
|
+
type: "written",
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const selectionList = quizList?.map((item) => ({
|
|
35
|
+
value: item?.key,
|
|
36
|
+
label: `Reponses ${item?.key}`,
|
|
37
|
+
}));
|
|
38
|
+
const selectedResponse =
|
|
39
|
+
quizList?.find((item) => item?.key === selected) || {};
|
|
40
|
+
|
|
41
|
+
const selectedModel = quizWrittenSelectedModel(selectedResponse, aiData);
|
|
42
|
+
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (selectedResponse) {
|
|
45
|
+
const models = setupAnalysis(
|
|
46
|
+
selectedModel,
|
|
47
|
+
selectedResponse?.recording,
|
|
48
|
+
data?.ai_score
|
|
49
|
+
);
|
|
50
|
+
setAnalysis(models);
|
|
51
|
+
}
|
|
52
|
+
}, [selectedResponse?.key]);
|
|
53
|
+
return (
|
|
54
|
+
<QuestionSection>
|
|
55
|
+
<Tabs
|
|
56
|
+
options={selectionList}
|
|
57
|
+
selected={selected}
|
|
58
|
+
onChange={setSelected}
|
|
59
|
+
/>
|
|
60
|
+
<QuestionDropdown>
|
|
61
|
+
<>
|
|
62
|
+
<li>
|
|
63
|
+
<h3>{findText("Instruction")}</h3>
|
|
64
|
+
<p>{data?.question_data?.instruction}</p>
|
|
65
|
+
</li>
|
|
66
|
+
<li>
|
|
67
|
+
<QuizQuestion data={data} />
|
|
68
|
+
</li>
|
|
69
|
+
<li>
|
|
70
|
+
<h3>{findText("Qyestion")}</h3>
|
|
71
|
+
<p>{data?.question_data?.question_data?.question}</p>
|
|
72
|
+
</li>
|
|
73
|
+
</>
|
|
74
|
+
</QuestionDropdown>
|
|
75
|
+
|
|
76
|
+
<Response response={selectedResponse?.text} isPersonal={isPersonal} />
|
|
77
|
+
|
|
78
|
+
<QuestionSectionWithAnalysis>
|
|
79
|
+
<QuestionSectionAction>
|
|
80
|
+
{analysis?.models?.length > 0 && (
|
|
81
|
+
<AnalysisButton
|
|
82
|
+
disabled={!(analysis?.models?.length > 0)}
|
|
83
|
+
onClick={() => {
|
|
84
|
+
setToggle({
|
|
85
|
+
...analysis,
|
|
86
|
+
defaultSelected: selected,
|
|
87
|
+
});
|
|
88
|
+
}}
|
|
89
|
+
/>
|
|
90
|
+
)}
|
|
91
|
+
</QuestionSectionAction>
|
|
92
|
+
</QuestionSectionWithAnalysis>
|
|
93
|
+
</QuestionSection>
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
export default QuizWritten;
|