l-min-components 1.7.1421 → 1.7.1422
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 +1 -1
- package/src/components/reportsComponents/fullAnalysis/components/ClarityItem.jsx +146 -14
- package/src/components/reportsComponents/fullAnalysis/components/Grammar.jsx +2 -10
- package/src/components/reportsComponents/fullAnalysis/components/SpeechAnalysis.jsx +66 -11
- package/src/components/reportsComponents/fullAnalysis/data.jsx +29521 -1193
- package/src/components/reportsComponents/hooks/useRreportUtils.jsx +48 -6
- package/src/components/reportsComponents/reportQuestions/components/modals/gradingModal.jsx +3 -3
- package/src/components/reportsComponents/reportQuestions/components/response.jsx +2 -3
- package/src/components/reportsComponents/reportQuestions/components/style/response.style.jsx +6 -0
- package/src/components/reportsComponents/reportQuestions/contants.jsx +16 -23
- package/src/components/reportsComponents/reportQuestions/index.jsx +9 -7
- package/src/components/reportsComponents/reportQuestions/questions/matchPair.jsx +6 -7
|
@@ -60,6 +60,28 @@ const quizResponses = ({ responses = [], type = "scripted" }) => {
|
|
|
60
60
|
});
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
+
const getColor = (aiScore) => {
|
|
64
|
+
if (!aiScore) return;
|
|
65
|
+
let color = "";
|
|
66
|
+
if (aiScore <= 27) {
|
|
67
|
+
color = "rgba(249, 84, 84, 1)";
|
|
68
|
+
} else if (aiScore >= 28 && aiScore <= 45) {
|
|
69
|
+
color = "rgba(151, 71, 255, 1)";
|
|
70
|
+
} else if (aiScore >= 46 && aiScore <= 60) {
|
|
71
|
+
color = "rgba(219, 136, 13, 1)";
|
|
72
|
+
} else if (aiScore >= 61 && aiScore <= 74) {
|
|
73
|
+
color = "rgba(229, 173, 14, 1)";
|
|
74
|
+
} else if (aiScore >= 75 && aiScore <= 87) {
|
|
75
|
+
color = "rgba(13, 95, 219, 1)";
|
|
76
|
+
} else if (aiScore >= 88 && aiScore <= 94) {
|
|
77
|
+
color = "rgba(13, 125, 150, 1)";
|
|
78
|
+
} else if (aiScore >= 95) {
|
|
79
|
+
color = "rgba(85, 193, 0, 1)";
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return color;
|
|
83
|
+
};
|
|
84
|
+
|
|
63
85
|
const dialogueResponses = ({
|
|
64
86
|
responses = [],
|
|
65
87
|
type = "scriped",
|
|
@@ -85,15 +107,26 @@ const dialogueResponses = ({
|
|
|
85
107
|
|
|
86
108
|
const getTrabScriptData = (models) => {
|
|
87
109
|
if (models?.length && models) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
110
|
+
const speechAnalysisModel = models.find(
|
|
111
|
+
(item) => item?.id === "speech_analysis"
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
if (speechAnalysisModel?.words) {
|
|
115
|
+
return speechAnalysisModel.words.map((item) => {
|
|
116
|
+
const aiScore = item?.["Word Score"] || 0;
|
|
117
|
+
let color = getColor(aiScore);
|
|
118
|
+
|
|
119
|
+
return {
|
|
120
|
+
aiScore: aiScore,
|
|
121
|
+
text: item?.wordText,
|
|
122
|
+
color: color,
|
|
123
|
+
};
|
|
124
|
+
});
|
|
125
|
+
}
|
|
94
126
|
}
|
|
95
127
|
return null;
|
|
96
128
|
};
|
|
129
|
+
|
|
97
130
|
const setupAnalysis = (data, audioData, score) => {
|
|
98
131
|
if (!data || typeof data !== "object") return;
|
|
99
132
|
const formatted = [];
|
|
@@ -187,6 +220,7 @@ const setupAnalysis = (data, audioData, score) => {
|
|
|
187
220
|
data?.speech_analysis?.[0]?.model_data?.["Reference"]
|
|
188
221
|
) {
|
|
189
222
|
const speechAnalysisData = data?.speech_analysis?.[0]?.model_data;
|
|
223
|
+
console.log(speechAnalysisData, "yyyy");
|
|
190
224
|
const score = speechAnalysisData?.["General Score"] || 0;
|
|
191
225
|
|
|
192
226
|
const words = Object.values(
|
|
@@ -294,6 +328,7 @@ const setupAnalysis = (data, audioData, score) => {
|
|
|
294
328
|
id: idx + 1,
|
|
295
329
|
wordText: word?.Word?.toLowerCase(),
|
|
296
330
|
isGood: word?.["Word Score"] > 45,
|
|
331
|
+
color: getColor(word?.["Word Score"]),
|
|
297
332
|
optionData,
|
|
298
333
|
};
|
|
299
334
|
});
|
|
@@ -570,6 +605,12 @@ const grammerCorrectParagraph = (data) => {
|
|
|
570
605
|
|
|
571
606
|
return paragraph;
|
|
572
607
|
};
|
|
608
|
+
const formatNumber = (number) => {
|
|
609
|
+
if (!number && typeof number !== "number") return "0.00";
|
|
610
|
+
|
|
611
|
+
const formattedNumber = number?.toFixed(2);
|
|
612
|
+
return formattedNumber;
|
|
613
|
+
};
|
|
573
614
|
const useReportUtils = () => {
|
|
574
615
|
return {
|
|
575
616
|
renderCorrectedSentence,
|
|
@@ -584,6 +625,7 @@ const useReportUtils = () => {
|
|
|
584
625
|
grammarFeekbackResult,
|
|
585
626
|
grammarCorrectResult,
|
|
586
627
|
grammerCorrectParagraph,
|
|
628
|
+
formatNumber,
|
|
587
629
|
};
|
|
588
630
|
};
|
|
589
631
|
|
|
@@ -16,11 +16,11 @@ const GradingModal = ({
|
|
|
16
16
|
const [selected, setSelected] = useState("manually");
|
|
17
17
|
const [value, setValue] = useState(defaultScore || "");
|
|
18
18
|
|
|
19
|
-
const numberValue =
|
|
19
|
+
const numberValue = parseFloat(value || 0);
|
|
20
20
|
const disable = selected === "manually" && (numberValue > 100 || !value);
|
|
21
21
|
|
|
22
|
-
const isNumbter =
|
|
23
|
-
const isSuggestionNumber =
|
|
22
|
+
const isNumbter = parseFloat(aiValue) || 0;
|
|
23
|
+
const isSuggestionNumber = parseFloat(suggestionValue) || 0;
|
|
24
24
|
|
|
25
25
|
const handleSetValue = () => {
|
|
26
26
|
setScore?.({
|
|
@@ -31,9 +31,7 @@ const Response = ({
|
|
|
31
31
|
if (isAiWordFlow && typeof response !== "string") {
|
|
32
32
|
const htmlString = response
|
|
33
33
|
?.map((item) => {
|
|
34
|
-
return
|
|
35
|
-
? `<span style="color: #30D468;">${item.text}</span>`
|
|
36
|
-
: `<span style="color: #F95454;">${item.text}</span>`;
|
|
34
|
+
return `<span style="color: ${item?.color};">${item?.text}</span>`;
|
|
37
35
|
})
|
|
38
36
|
.join(" ");
|
|
39
37
|
return htmlString;
|
|
@@ -41,6 +39,7 @@ const Response = ({
|
|
|
41
39
|
return response;
|
|
42
40
|
};
|
|
43
41
|
const htmlString = setupAiWordFlow();
|
|
42
|
+
|
|
44
43
|
return (
|
|
45
44
|
<ResponseContainer>
|
|
46
45
|
{title && <h3>{title}</h3>}
|
package/src/components/reportsComponents/reportQuestions/components/style/response.style.jsx
CHANGED
|
@@ -21,6 +21,9 @@ export const ResponseContent = styled.div`
|
|
|
21
21
|
export const ResponseAiWordFlow = styled.div`
|
|
22
22
|
color: #4a4d4d;
|
|
23
23
|
font-size: 16px;
|
|
24
|
+
&::first-letter {
|
|
25
|
+
text-transform: capitalize;
|
|
26
|
+
}
|
|
24
27
|
`;
|
|
25
28
|
|
|
26
29
|
export const FallbackResponse = styled(ResponseContent)`
|
|
@@ -40,5 +43,8 @@ export const FallbackResponse = styled(ResponseContent)`
|
|
|
40
43
|
&.good-fallback {
|
|
41
44
|
color: #30d468;
|
|
42
45
|
}
|
|
46
|
+
&::first-letter {
|
|
47
|
+
text-transform: capitalize;
|
|
48
|
+
}
|
|
43
49
|
}
|
|
44
50
|
`;
|
|
@@ -862,52 +862,45 @@ const reading = {
|
|
|
862
862
|
};
|
|
863
863
|
|
|
864
864
|
const natchPair = {
|
|
865
|
-
question_id:
|
|
866
|
-
question_activity_id:
|
|
865
|
+
question_id: 3316,
|
|
866
|
+
question_activity_id: 8636,
|
|
867
867
|
position_index: 0,
|
|
868
|
-
title: "
|
|
868
|
+
title: "Pair 1",
|
|
869
869
|
type: "MATCH_PAIR",
|
|
870
870
|
question_data: {
|
|
871
871
|
type: "MATCH_PAIR",
|
|
872
872
|
question_title: " ",
|
|
873
|
-
question_data: {
|
|
874
|
-
Cat: "Meow\n\n",
|
|
875
|
-
Cow: "Moo",
|
|
876
|
-
Dog: "Bark",
|
|
877
|
-
Goat: "Bleat",
|
|
878
|
-
Lion: "Roar",
|
|
879
|
-
},
|
|
873
|
+
question_data: { Boy: "Girl", Hello: "Word", James: "Doe" },
|
|
880
874
|
no_of_attempts: 2,
|
|
881
|
-
instruction: "
|
|
875
|
+
instruction: "Pair 1",
|
|
882
876
|
},
|
|
883
877
|
answer: {
|
|
884
|
-
session_id: "
|
|
885
|
-
attempt_index:
|
|
878
|
+
session_id: "52e7d900d7d34c7bba2c9fe385609049",
|
|
879
|
+
attempt_index: 8,
|
|
886
880
|
token_claimed: 0,
|
|
887
881
|
score: null,
|
|
888
882
|
marked: false,
|
|
889
883
|
expire_at: null,
|
|
890
|
-
created_at: "2025-07-
|
|
884
|
+
created_at: "2025-07-21T13:48:18.454224Z",
|
|
891
885
|
grading_date: null,
|
|
892
886
|
data: {
|
|
893
887
|
type: "MATCH_PAIR",
|
|
894
|
-
session_id: "
|
|
895
|
-
submited_datetime: "2025-07-
|
|
888
|
+
session_id: "149bdd0fb30745a",
|
|
889
|
+
submited_datetime: "2025-07-20T18:43:25.848341Z",
|
|
896
890
|
responses: {
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
4: { type: "MatchPair", value: "" },
|
|
901
|
-
5: { type: "MatchPair", value: "Moo" },
|
|
891
|
+
Boy: { type: "MatchPair", value: "Doe" },
|
|
892
|
+
Hello: { type: "MatchPair", value: "Word" },
|
|
893
|
+
James: { type: "MatchPair", value: "Girl" },
|
|
902
894
|
},
|
|
903
895
|
},
|
|
904
896
|
comments: null,
|
|
905
897
|
},
|
|
906
898
|
score: 0,
|
|
907
|
-
ai_score:
|
|
899
|
+
ai_score: null,
|
|
908
900
|
grading_data: {},
|
|
909
901
|
grade_method: "MANUAL",
|
|
910
|
-
suggested_score:
|
|
902
|
+
suggested_score: 33.3,
|
|
903
|
+
ai_score_available: true,
|
|
911
904
|
};
|
|
912
905
|
|
|
913
906
|
const quizScriptedWithImage = {
|
|
@@ -40,6 +40,7 @@ import FullAnalysis from "../fullAnalysis";
|
|
|
40
40
|
import useApi from "./api";
|
|
41
41
|
import FullPageLoader from "../../fullPageLoader";
|
|
42
42
|
import { OutletContext } from "../..";
|
|
43
|
+
import useReportUtils from "../hooks/useRreportUtils";
|
|
43
44
|
|
|
44
45
|
/**
|
|
45
46
|
* @param {Object} props
|
|
@@ -63,6 +64,7 @@ const ReportQuestions = ({
|
|
|
63
64
|
const [toggle, setToggle] = useState(null);
|
|
64
65
|
const { affiliateAccount } = useContext(OutletContext);
|
|
65
66
|
const enterpriseId = affiliateAccount?.id;
|
|
67
|
+
const { formatNumber } = useReportUtils();
|
|
66
68
|
const { handleGradeQuestion, gradeQuestionData } = useApi();
|
|
67
69
|
|
|
68
70
|
const question = constants.questions.find(
|
|
@@ -124,11 +126,11 @@ const ReportQuestions = ({
|
|
|
124
126
|
{gradeQuestionData?.loading && <FullPageLoader fixed hasBackground />}
|
|
125
127
|
{toggleGrade && (
|
|
126
128
|
<GradingModal
|
|
127
|
-
aiValue={data?.ai_score}
|
|
128
|
-
suggestionValue={data?.suggested_score}
|
|
129
|
+
aiValue={formatNumber(data?.ai_score)}
|
|
130
|
+
suggestionValue={formatNumber(data?.suggested_score)}
|
|
129
131
|
noAi={noAi}
|
|
130
132
|
setScore={handleScore}
|
|
131
|
-
defaultScore={intructorScore}
|
|
133
|
+
defaultScore={formatNumber(intructorScore)}
|
|
132
134
|
showAIScore={showAIScore}
|
|
133
135
|
onClose={() => {
|
|
134
136
|
setToggleGrade(false);
|
|
@@ -147,7 +149,7 @@ const ReportQuestions = ({
|
|
|
147
149
|
<ScoreHeader>
|
|
148
150
|
{accountType === "personal" ? (
|
|
149
151
|
<ScoreBadge>
|
|
150
|
-
Instructor’s score: <span>{
|
|
152
|
+
Instructor’s score: <span>{formatNumber(intructorScore)}%</span>
|
|
151
153
|
</ScoreBadge>
|
|
152
154
|
) : (
|
|
153
155
|
<>
|
|
@@ -158,7 +160,7 @@ const ReportQuestions = ({
|
|
|
158
160
|
hidden: !noAi,
|
|
159
161
|
})}
|
|
160
162
|
>
|
|
161
|
-
Score: <span>{
|
|
163
|
+
Score: <span>{formatNumber(data?.suggested_score)}%</span>
|
|
162
164
|
</ScoreBadge>
|
|
163
165
|
) : (
|
|
164
166
|
showAIScore && (
|
|
@@ -168,7 +170,7 @@ const ReportQuestions = ({
|
|
|
168
170
|
hidden: noAi,
|
|
169
171
|
})}
|
|
170
172
|
>
|
|
171
|
-
AI score: <span>{
|
|
173
|
+
AI score: <span>{formatNumber(data?.ai_score)}%</span>
|
|
172
174
|
</ScoreBadge>
|
|
173
175
|
)
|
|
174
176
|
)}
|
|
@@ -181,7 +183,7 @@ const ReportQuestions = ({
|
|
|
181
183
|
}
|
|
182
184
|
>
|
|
183
185
|
Instructor’s score:{" "}
|
|
184
|
-
<span>{
|
|
186
|
+
<span>{formatNumber(intructorScore)}%</span>
|
|
185
187
|
</ScoreBadge>
|
|
186
188
|
{(accountType === "instructor-personal" ||
|
|
187
189
|
accountType === "instructor-affiliate") && (
|
|
@@ -14,16 +14,14 @@ import ButtonComponent from "../../../button";
|
|
|
14
14
|
const MatchPair = ({ data }) => {
|
|
15
15
|
const [pairPreview, setPairPreview] = useState(null);
|
|
16
16
|
const getMatchAndCorrectPair = () => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const answerList = Object.values(data?.answer?.data?.responses || {});
|
|
22
|
-
|
|
17
|
+
const responses = data?.question_data?.question_data;
|
|
18
|
+
if (responses) {
|
|
19
|
+
const questionList = Object.entries(responses || {});
|
|
20
|
+
const answerResponses = data?.answer?.data?.responses;
|
|
23
21
|
const formattedList = questionList?.map((item, index) => {
|
|
24
22
|
const match = item?.[0];
|
|
25
23
|
const correct = item?.[1];
|
|
26
|
-
const responseValue =
|
|
24
|
+
const responseValue = answerResponses?.[match]?.value;
|
|
27
25
|
return {
|
|
28
26
|
question: match,
|
|
29
27
|
answer: responseValue,
|
|
@@ -38,6 +36,7 @@ const MatchPair = ({ data }) => {
|
|
|
38
36
|
};
|
|
39
37
|
|
|
40
38
|
const matchPairList = getMatchAndCorrectPair();
|
|
39
|
+
|
|
41
40
|
return (
|
|
42
41
|
<>
|
|
43
42
|
{pairPreview && (
|