catchup-library-web 2.0.7 → 2.0.9
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/index.d.mts +26 -27
- package/dist/index.d.ts +26 -27
- package/dist/index.js +287 -527
- package/dist/index.mjs +287 -526
- package/package.json +1 -1
- package/src/components/activities/ActivityPreviewByAnswerData.tsx +118 -121
- package/src/components/activities/ActivityPreviewByData.tsx +10 -10
- package/src/components/activities/DropdownActivityContent.tsx +9 -35
- package/src/components/activities/FillInTheBlanksActivityContent.tsx +9 -34
- package/src/components/activities/GroupingActivityContent.tsx +4 -8
- package/src/components/activities/MCMAActivityContent.tsx +8 -8
- package/src/components/activities/MCSAActivityContent.tsx +8 -8
- package/src/components/activities/MatchingActivityContent.tsx +4 -8
- package/src/components/activities/OpenEndedActivityContent.tsx +4 -8
- package/src/components/activities/OrderingActivityContent.tsx +4 -8
- package/src/components/activities/TrueFalseActivityContent.tsx +4 -12
- package/src/components/activities/material-contents/DropdownActivityMaterialContent.tsx +9 -19
- package/src/components/activities/material-contents/FillInTheBlanksActivityMaterialContent.tsx +9 -24
- package/src/components/activities/material-contents/GroupingActivityMaterialContent.tsx +7 -18
- package/src/components/activities/material-contents/MCMAActivityMaterialContent.tsx +2 -10
- package/src/components/activities/material-contents/MCSAActivityMaterialContent.tsx +2 -10
- package/src/components/activities/material-contents/MatchingActivityMaterialContent.tsx +7 -17
- package/src/components/activities/material-contents/OpenEndedActivityMaterialContent.tsx +2 -21
- package/src/components/activities/material-contents/OrderingActivityMaterialContent.tsx +4 -16
- package/src/components/activities/material-contents/TrueFalseActivityMaterialContent.tsx +4 -27
- package/src/properties/ActivityProperties.ts +21 -20
- package/src/utilization/CatchtivityUtilization.ts +55 -147
|
@@ -7,7 +7,7 @@ import { IOrderingActivityMaterialProps } from "../../../properties/ActivityProp
|
|
|
7
7
|
|
|
8
8
|
const OrderingActivityMaterialContent = ({
|
|
9
9
|
uniqueValue,
|
|
10
|
-
|
|
10
|
+
answerMap,
|
|
11
11
|
materialMap,
|
|
12
12
|
contentMap,
|
|
13
13
|
checkCanAnswerQuestion,
|
|
@@ -44,21 +44,11 @@ const OrderingActivityMaterialContent = ({
|
|
|
44
44
|
|
|
45
45
|
useEffect(() => {
|
|
46
46
|
if (!showCorrectAnswer) return;
|
|
47
|
-
const answerMap = answer.data.find(
|
|
48
|
-
(answerData: any) => answerData.type === "ORDERING"
|
|
49
|
-
).answerMap;
|
|
50
47
|
Object.keys(answerMap).forEach((answerKey, index) => {
|
|
51
48
|
answerMap[answerKey] = index;
|
|
52
49
|
});
|
|
53
50
|
}, [showCorrectAnswer]);
|
|
54
51
|
|
|
55
|
-
const retrieveAnswerMap = () => {
|
|
56
|
-
const foundIndex = answer.data.findIndex(
|
|
57
|
-
(answerData: any) => answerData.type === "ORDERING"
|
|
58
|
-
);
|
|
59
|
-
return answer.data[foundIndex].answerMap;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
52
|
const checkAnswerState = (correctAnswer: string, learnerAnswer: string) => {
|
|
63
53
|
if (!isPreview) return null;
|
|
64
54
|
if (correctAnswer === learnerAnswer) {
|
|
@@ -120,7 +110,7 @@ const OrderingActivityMaterialContent = ({
|
|
|
120
110
|
draggedKey !== null &&
|
|
121
111
|
dropTargetKey !== draggedKey
|
|
122
112
|
) {
|
|
123
|
-
onChange(
|
|
113
|
+
onChange(answerMap, draggedKey, dropTargetKey);
|
|
124
114
|
}
|
|
125
115
|
setDraggedKey(null);
|
|
126
116
|
setDropTargetKey(null);
|
|
@@ -168,7 +158,7 @@ const OrderingActivityMaterialContent = ({
|
|
|
168
158
|
draggedKey !== null &&
|
|
169
159
|
dropTargetKey !== draggedKey
|
|
170
160
|
) {
|
|
171
|
-
onChange(
|
|
161
|
+
onChange(answerMap, draggedKey, dropTargetKey);
|
|
172
162
|
}
|
|
173
163
|
setDraggedKey(null);
|
|
174
164
|
setDropTargetKey(null);
|
|
@@ -185,14 +175,12 @@ const OrderingActivityMaterialContent = ({
|
|
|
185
175
|
} else if (selectedKey === materialKey) {
|
|
186
176
|
setSelectedKey(null);
|
|
187
177
|
} else {
|
|
188
|
-
onChange(
|
|
178
|
+
onChange(answerMap, selectedKey, materialKey);
|
|
189
179
|
setSelectedKey(null);
|
|
190
180
|
}
|
|
191
181
|
setDraggedKey(null);
|
|
192
182
|
};
|
|
193
183
|
|
|
194
|
-
const answerMap = retrieveAnswerMap();
|
|
195
|
-
|
|
196
184
|
return (
|
|
197
185
|
<div
|
|
198
186
|
className="flex flex-row flex-wrap"
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useEffect, useState } from "react";
|
|
2
|
-
import useScreenSize from "../../../hooks/useScreenSize";
|
|
3
2
|
import i18n from "../../../language/i18n";
|
|
4
3
|
import ShowMaterialMediaByContentType from "./ShowMaterialMediaByContentType";
|
|
5
4
|
import { InlineMath } from "react-katex";
|
|
@@ -11,7 +10,7 @@ import { shuffleArray } from "../../../utilization/AppUtilization";
|
|
|
11
10
|
|
|
12
11
|
const TrueFalseActivityMaterialContent = ({
|
|
13
12
|
uniqueValue,
|
|
14
|
-
|
|
13
|
+
answerMap,
|
|
15
14
|
materialMap,
|
|
16
15
|
contentMap,
|
|
17
16
|
checkCanAnswerQuestion,
|
|
@@ -19,7 +18,6 @@ const TrueFalseActivityMaterialContent = ({
|
|
|
19
18
|
isPreview,
|
|
20
19
|
showCorrectAnswer,
|
|
21
20
|
}: ITrueFalseActivityMaterialProps) => {
|
|
22
|
-
const { screenSize } = useScreenSize();
|
|
23
21
|
const [shuffleOptionList, setShuffleOptionList] = useState<any[]>([]);
|
|
24
22
|
|
|
25
23
|
useEffect(() => {
|
|
@@ -35,29 +33,9 @@ const TrueFalseActivityMaterialContent = ({
|
|
|
35
33
|
|
|
36
34
|
useEffect(() => {
|
|
37
35
|
if (!showCorrectAnswer) return;
|
|
38
|
-
|
|
39
|
-
(answerData: any) => answerData.type === "TRUE_FALSE"
|
|
40
|
-
).answerMap = materialMap;
|
|
36
|
+
answerMap = materialMap;
|
|
41
37
|
}, [showCorrectAnswer]);
|
|
42
38
|
|
|
43
|
-
const retrieveAnswer = () => {
|
|
44
|
-
if (!answer)
|
|
45
|
-
return {
|
|
46
|
-
answerMap: {
|
|
47
|
-
trueList: [],
|
|
48
|
-
falseList: [],
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
return answer.data.find(
|
|
52
|
-
(answerData: any) => answerData.type === "TRUE_FALSE"
|
|
53
|
-
);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const retrieveAnswerMap = () => {
|
|
57
|
-
const { answerMap } = retrieveAnswer();
|
|
58
|
-
return answerMap;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
39
|
const checkAnswerState = (correctAnswer: string, learnerAnswer: string) => {
|
|
62
40
|
if (!isPreview) return null;
|
|
63
41
|
if (correctAnswer === learnerAnswer) {
|
|
@@ -66,7 +44,6 @@ const TrueFalseActivityMaterialContent = ({
|
|
|
66
44
|
return "INCORRECT";
|
|
67
45
|
};
|
|
68
46
|
|
|
69
|
-
const answerMap = retrieveAnswerMap();
|
|
70
47
|
return (
|
|
71
48
|
<div className="">
|
|
72
49
|
<div className="hidden md:block">
|
|
@@ -160,7 +137,7 @@ const TrueFalseActivityMaterialContent = ({
|
|
|
160
137
|
alt="checkbox"
|
|
161
138
|
size="small"
|
|
162
139
|
onClick={() => {
|
|
163
|
-
onChange(
|
|
140
|
+
onChange(answerMap, "TRUE", shuffleOption);
|
|
164
141
|
}}
|
|
165
142
|
/>
|
|
166
143
|
</div>
|
|
@@ -176,7 +153,7 @@ const TrueFalseActivityMaterialContent = ({
|
|
|
176
153
|
alt="checkbox"
|
|
177
154
|
size="small"
|
|
178
155
|
onClick={() => {
|
|
179
|
-
onChange(
|
|
156
|
+
onChange(answerMap, "FALSE", shuffleOption);
|
|
180
157
|
}}
|
|
181
158
|
/>
|
|
182
159
|
</div>
|
|
@@ -20,7 +20,7 @@ export interface IActivityBodyContentProps {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export interface IOrderingActivityProps {
|
|
23
|
-
|
|
23
|
+
answerMap: any;
|
|
24
24
|
data: any;
|
|
25
25
|
canAnswerQuestion: () => boolean;
|
|
26
26
|
changeAnswer: (e: any) => void;
|
|
@@ -31,7 +31,7 @@ export interface IOrderingActivityProps {
|
|
|
31
31
|
|
|
32
32
|
export interface IOrderingActivityMaterialProps {
|
|
33
33
|
uniqueValue: string;
|
|
34
|
-
|
|
34
|
+
answerMap: any;
|
|
35
35
|
materialMap: any;
|
|
36
36
|
contentMap: any;
|
|
37
37
|
checkCanAnswerQuestion: () => boolean;
|
|
@@ -41,7 +41,7 @@ export interface IOrderingActivityMaterialProps {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
export interface IDropdownActivityProps {
|
|
44
|
-
|
|
44
|
+
answerMap: any;
|
|
45
45
|
data: any;
|
|
46
46
|
canAnswerQuestion: () => boolean;
|
|
47
47
|
changeAnswer: (e: any) => void;
|
|
@@ -52,7 +52,7 @@ export interface IDropdownActivityProps {
|
|
|
52
52
|
|
|
53
53
|
export interface IDropdownActivityMaterialProps {
|
|
54
54
|
uniqueValue: string;
|
|
55
|
-
|
|
55
|
+
answerMap: any;
|
|
56
56
|
materialMap: any;
|
|
57
57
|
contentMap: any;
|
|
58
58
|
checkCanAnswerQuestion: () => boolean;
|
|
@@ -62,7 +62,7 @@ export interface IDropdownActivityMaterialProps {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
export interface IMCSAActivityProps {
|
|
65
|
-
|
|
65
|
+
answerMap: any;
|
|
66
66
|
data: any;
|
|
67
67
|
canAnswerQuestion: () => boolean;
|
|
68
68
|
changeAnswer: (e: any) => void;
|
|
@@ -73,7 +73,7 @@ export interface IMCSAActivityProps {
|
|
|
73
73
|
|
|
74
74
|
export interface IMCSAActivityMaterialProps {
|
|
75
75
|
uniqueValue: string;
|
|
76
|
-
|
|
76
|
+
answerMap: any;
|
|
77
77
|
materialMap: any;
|
|
78
78
|
contentMap: any;
|
|
79
79
|
checkCanAnswerQuestion: () => boolean;
|
|
@@ -82,7 +82,7 @@ export interface IMCSAActivityMaterialProps {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
export interface IMCMAActivityProps {
|
|
85
|
-
|
|
85
|
+
answerMap: any;
|
|
86
86
|
data: any;
|
|
87
87
|
canAnswerQuestion: () => boolean;
|
|
88
88
|
changeAnswer: (e: any) => void;
|
|
@@ -93,7 +93,7 @@ export interface IMCMAActivityProps {
|
|
|
93
93
|
|
|
94
94
|
export interface IMCMAActivityMaterialProps {
|
|
95
95
|
uniqueValue: string;
|
|
96
|
-
|
|
96
|
+
answerMap: any;
|
|
97
97
|
materialMap: any;
|
|
98
98
|
contentMap: any;
|
|
99
99
|
checkCanAnswerQuestion: () => boolean;
|
|
@@ -102,7 +102,7 @@ export interface IMCMAActivityMaterialProps {
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
export interface IGroupingActivityProps {
|
|
105
|
-
|
|
105
|
+
answerMap: any;
|
|
106
106
|
data: any;
|
|
107
107
|
canAnswerQuestion: () => boolean;
|
|
108
108
|
changeAnswer: (e: any) => void;
|
|
@@ -112,7 +112,7 @@ export interface IGroupingActivityProps {
|
|
|
112
112
|
|
|
113
113
|
export interface IGroupingActivityMaterialProps {
|
|
114
114
|
uniqueValue: string;
|
|
115
|
-
|
|
115
|
+
answerMap: any;
|
|
116
116
|
materialMap: any;
|
|
117
117
|
contentMap: any;
|
|
118
118
|
checkCanAnswerQuestion: () => boolean;
|
|
@@ -122,7 +122,7 @@ export interface IGroupingActivityMaterialProps {
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
export interface IMatchingActivityProps {
|
|
125
|
-
|
|
125
|
+
answerMap: any;
|
|
126
126
|
data: any;
|
|
127
127
|
canAnswerQuestion: () => boolean;
|
|
128
128
|
changeAnswer: (e: any) => void;
|
|
@@ -132,7 +132,7 @@ export interface IMatchingActivityProps {
|
|
|
132
132
|
|
|
133
133
|
export interface IMatchingActivityMaterialProps {
|
|
134
134
|
uniqueValue: string;
|
|
135
|
-
|
|
135
|
+
answerMap: any;
|
|
136
136
|
materialMap: any;
|
|
137
137
|
contentMap: any;
|
|
138
138
|
checkCanAnswerQuestion: () => boolean;
|
|
@@ -142,7 +142,7 @@ export interface IMatchingActivityMaterialProps {
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
export interface IFillInTheBlanksActivityProps {
|
|
145
|
-
|
|
145
|
+
answerMap: any;
|
|
146
146
|
data: any;
|
|
147
147
|
canAnswerQuestion: () => boolean;
|
|
148
148
|
changeAnswer: (e: any) => void;
|
|
@@ -153,7 +153,7 @@ export interface IFillInTheBlanksActivityProps {
|
|
|
153
153
|
|
|
154
154
|
export interface IFillInTheBlanksActivityMaterialProps {
|
|
155
155
|
uniqueValue: string;
|
|
156
|
-
|
|
156
|
+
answerMap: any;
|
|
157
157
|
optionList: any;
|
|
158
158
|
materialMap: any;
|
|
159
159
|
contentMap: any;
|
|
@@ -164,7 +164,7 @@ export interface IFillInTheBlanksActivityMaterialProps {
|
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
export interface IOpenEndedActivityProps {
|
|
167
|
-
|
|
167
|
+
answerMap: any;
|
|
168
168
|
data: any;
|
|
169
169
|
changeAnswer: (e: any) => void;
|
|
170
170
|
canAnswerQuestion: () => boolean;
|
|
@@ -174,14 +174,14 @@ export interface IOpenEndedActivityProps {
|
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
export interface IOpenEndedActivityMaterialProps {
|
|
177
|
-
|
|
177
|
+
answerMap: any;
|
|
178
178
|
contentMap: any;
|
|
179
179
|
checkCanAnswerQuestion: () => boolean;
|
|
180
180
|
onChange: (e1: any, e2: any) => void;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
export interface ITrueFalseActivityProps {
|
|
184
|
-
|
|
184
|
+
answerMap: any;
|
|
185
185
|
data: any;
|
|
186
186
|
canAnswerQuestion: () => boolean;
|
|
187
187
|
changeAnswer: (e: any) => void;
|
|
@@ -192,7 +192,7 @@ export interface ITrueFalseActivityProps {
|
|
|
192
192
|
|
|
193
193
|
export interface ITrueFalseActivityMaterialProps {
|
|
194
194
|
uniqueValue: string;
|
|
195
|
-
|
|
195
|
+
answerMap: any;
|
|
196
196
|
materialMap: any;
|
|
197
197
|
contentMap: any;
|
|
198
198
|
checkCanAnswerQuestion: () => boolean;
|
|
@@ -232,10 +232,11 @@ export interface IActivityPreviewByDataProps {
|
|
|
232
232
|
|
|
233
233
|
export interface IActivityPreviewByAnswerDataProps {
|
|
234
234
|
data: any;
|
|
235
|
+
answerType?: string | null;
|
|
235
236
|
showType?: boolean;
|
|
236
237
|
showDescription?: boolean;
|
|
237
|
-
|
|
238
|
-
typeOptionList?: any[];
|
|
238
|
+
lockedTypeList?: any[];
|
|
239
|
+
// typeOptionList?: any[];
|
|
239
240
|
showSolution?: boolean;
|
|
240
241
|
showEvaluationRubric?: boolean;
|
|
241
242
|
showDifficulty?: boolean;
|
|
@@ -1178,47 +1178,31 @@ const retrieveDefaultTrueFalseMap = () => {
|
|
|
1178
1178
|
};
|
|
1179
1179
|
|
|
1180
1180
|
export const retrieveCurrentDefaultDataMap = (
|
|
1181
|
-
|
|
1181
|
+
activityTemplateType: any,
|
|
1182
1182
|
activityData: any
|
|
1183
1183
|
) => {
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
if (
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
);
|
|
1192
|
-
} else if (
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
);
|
|
1196
|
-
} else if (
|
|
1197
|
-
|
|
1198
|
-
activityData.MCSAMaterialMap
|
|
1199
|
-
);
|
|
1200
|
-
} else if (activityTemplate.type === "MCMA") {
|
|
1201
|
-
defaultDataMap.answerMap = retrieveDefaultMCMAMap(
|
|
1202
|
-
activityData.MCMAMaterialMap
|
|
1203
|
-
);
|
|
1204
|
-
} else if (activityTemplate.type === "MATCHING") {
|
|
1205
|
-
defaultDataMap.answerMap = retrieveDefaultMatchingMap(
|
|
1206
|
-
activityData.matchingMaterialMap
|
|
1207
|
-
);
|
|
1208
|
-
} else if (activityTemplate.type === "GROUPING") {
|
|
1209
|
-
defaultDataMap.answerMap = retrieveDefaultGroupingMap(
|
|
1210
|
-
activityData.groupingMaterialMap
|
|
1211
|
-
);
|
|
1212
|
-
} else if (activityTemplate.type === "FILL_IN_THE_BLANKS") {
|
|
1213
|
-
defaultDataMap.answerMap = retrieveDefaultFillInTheBlanksMap(
|
|
1184
|
+
if (activityTemplateType === "ORDERING") {
|
|
1185
|
+
return retrieveDefaultOrderingDataMap(activityData.orderingMaterialMap);
|
|
1186
|
+
} else if (activityTemplateType === "DROPDOWN") {
|
|
1187
|
+
return retrieveDefaultDropdownMap(activityData.dropdownMaterialMap);
|
|
1188
|
+
} else if (activityTemplateType === "MCSA") {
|
|
1189
|
+
return retrieveDefaultMCSAMap(activityData.MCSAMaterialMap);
|
|
1190
|
+
} else if (activityTemplateType === "MCMA") {
|
|
1191
|
+
return retrieveDefaultMCMAMap(activityData.MCMAMaterialMap);
|
|
1192
|
+
} else if (activityTemplateType === "MATCHING") {
|
|
1193
|
+
return retrieveDefaultMatchingMap(activityData.matchingMaterialMap);
|
|
1194
|
+
} else if (activityTemplateType === "GROUPING") {
|
|
1195
|
+
return retrieveDefaultGroupingMap(activityData.groupingMaterialMap);
|
|
1196
|
+
} else if (activityTemplateType === "FILL_IN_THE_BLANKS") {
|
|
1197
|
+
return retrieveDefaultFillInTheBlanksMap(
|
|
1214
1198
|
activityData.fillInTheBlanksMaterialMap
|
|
1215
1199
|
);
|
|
1216
|
-
} else if (
|
|
1217
|
-
|
|
1218
|
-
} else if (
|
|
1219
|
-
|
|
1200
|
+
} else if (activityTemplateType === "OPEN_ENDED") {
|
|
1201
|
+
return retrieveDefaultOpenEndedMap();
|
|
1202
|
+
} else if (activityTemplateType === "TRUE_FALSE") {
|
|
1203
|
+
return retrieveDefaultTrueFalseMap();
|
|
1220
1204
|
}
|
|
1221
|
-
return
|
|
1205
|
+
return {};
|
|
1222
1206
|
};
|
|
1223
1207
|
|
|
1224
1208
|
export const constructActivityAnswerMap = (
|
|
@@ -1254,7 +1238,7 @@ export const constructActivityAnswerMap = (
|
|
|
1254
1238
|
} else if (activityTemplate.type === "TRUE_FALSE") {
|
|
1255
1239
|
activityData.trueFalseMaterialMap = { trueList: [], falseList: [] };
|
|
1256
1240
|
}
|
|
1257
|
-
return retrieveCurrentDefaultDataMap(activityTemplate, activityData);
|
|
1241
|
+
return retrieveCurrentDefaultDataMap(activityTemplate.type, activityData);
|
|
1258
1242
|
};
|
|
1259
1243
|
|
|
1260
1244
|
export const ignoreMathematicalExpression = (inputText: string) => {
|
|
@@ -1268,64 +1252,9 @@ export const ignoreMathematicalExpression = (inputText: string) => {
|
|
|
1268
1252
|
.replaceAll("\\sqrt", "");
|
|
1269
1253
|
};
|
|
1270
1254
|
|
|
1271
|
-
export const checkIfAnswerIsEmpty = (answer: any) => {
|
|
1272
|
-
const { data } = answer;
|
|
1273
|
-
if (data && data.length > 0) {
|
|
1274
|
-
const foundAnswer = data[0];
|
|
1275
|
-
const { type, answerMap } = foundAnswer;
|
|
1276
|
-
if (type === "ORDERING") {
|
|
1277
|
-
return false;
|
|
1278
|
-
} else if (type === "DROPDOWN") {
|
|
1279
|
-
for (const key of Object.keys(answerMap)) {
|
|
1280
|
-
if (answerMap[key] !== "DEFAULT_OPTION") {
|
|
1281
|
-
return false;
|
|
1282
|
-
}
|
|
1283
|
-
}
|
|
1284
|
-
} else if (type === "MCSA") {
|
|
1285
|
-
const key = Object.keys(answerMap)[0];
|
|
1286
|
-
if (answerMap[key] !== "ANSWER_KEY") {
|
|
1287
|
-
return false;
|
|
1288
|
-
}
|
|
1289
|
-
} else if (type === "MCMA") {
|
|
1290
|
-
const key = Object.keys(answerMap)[0];
|
|
1291
|
-
if (answerMap[key].length !== 0) {
|
|
1292
|
-
return false;
|
|
1293
|
-
}
|
|
1294
|
-
} else if (type === "MATCHING") {
|
|
1295
|
-
for (const key of Object.keys(answerMap)) {
|
|
1296
|
-
if (answerMap[key]) {
|
|
1297
|
-
return false;
|
|
1298
|
-
}
|
|
1299
|
-
}
|
|
1300
|
-
} else if (type === "GROUPING") {
|
|
1301
|
-
for (const key of Object.keys(answerMap)) {
|
|
1302
|
-
if (answerMap[key].length !== 0) {
|
|
1303
|
-
return false;
|
|
1304
|
-
}
|
|
1305
|
-
}
|
|
1306
|
-
} else if (type === "FILL_IN_THE_BLANKS") {
|
|
1307
|
-
for (const key of Object.keys(answerMap)) {
|
|
1308
|
-
if (answerMap[key]) {
|
|
1309
|
-
return false;
|
|
1310
|
-
}
|
|
1311
|
-
}
|
|
1312
|
-
} else if (type === "OPEN_ENDED") {
|
|
1313
|
-
const key = Object.keys(answerMap)[0];
|
|
1314
|
-
if (answerMap[key]) {
|
|
1315
|
-
return false;
|
|
1316
|
-
}
|
|
1317
|
-
} else if (type === "TRUE_FALSE") {
|
|
1318
|
-
return (
|
|
1319
|
-
answerMap.trueList.length === 0 && answerMap.falseList.length === 0
|
|
1320
|
-
);
|
|
1321
|
-
}
|
|
1322
|
-
}
|
|
1323
|
-
return true;
|
|
1324
|
-
};
|
|
1325
|
-
|
|
1326
1255
|
export const constructActivityAnswerStateList = (
|
|
1327
|
-
answerList: any,
|
|
1328
|
-
activityList: any
|
|
1256
|
+
answerList: any[],
|
|
1257
|
+
activityList: any[]
|
|
1329
1258
|
) => {
|
|
1330
1259
|
const stateList: any = [];
|
|
1331
1260
|
activityList.forEach((activity: any, index: number) => {
|
|
@@ -1339,17 +1268,15 @@ export const constructActivityAnswerStateList = (
|
|
|
1339
1268
|
};
|
|
1340
1269
|
|
|
1341
1270
|
export const retrieveActivityAnswerFromAnswerList = (
|
|
1342
|
-
answerList: any,
|
|
1271
|
+
answerList: any[],
|
|
1343
1272
|
activity: any
|
|
1344
1273
|
) => {
|
|
1345
|
-
// if (!answerList || !activity) return;
|
|
1346
1274
|
return answerList.find(
|
|
1347
|
-
(answer: any) =>
|
|
1348
|
-
parseFloat(answer.activityDTO.id) === parseFloat(activity.id)
|
|
1275
|
+
(answer: any) => parseFloat(answer.activityId) === parseFloat(activity.id)
|
|
1349
1276
|
);
|
|
1350
1277
|
};
|
|
1351
1278
|
|
|
1352
|
-
export const checkActivityAnswerState = (answerList: any, activity: any) => {
|
|
1279
|
+
export const checkActivityAnswerState = (answerList: any[], activity: any) => {
|
|
1353
1280
|
const activityAnswer = retrieveActivityAnswerFromAnswerList(
|
|
1354
1281
|
answerList,
|
|
1355
1282
|
activity
|
|
@@ -1579,7 +1506,7 @@ export const retrieveEachTimeSpentInSeconds = (
|
|
|
1579
1506
|
if (!activityProgressList || !activity) return 0;
|
|
1580
1507
|
const foundActivityProgress = activityProgressList.find(
|
|
1581
1508
|
(activityProgress: any) =>
|
|
1582
|
-
parseFloat(activityProgress.
|
|
1509
|
+
parseFloat(activityProgress.activityId) === parseFloat(activity.id)
|
|
1583
1510
|
);
|
|
1584
1511
|
if (foundActivityProgress) {
|
|
1585
1512
|
return foundActivityProgress.timeSpent / 1000;
|
|
@@ -1997,53 +1924,40 @@ export const constructActivityData = (
|
|
|
1997
1924
|
};
|
|
1998
1925
|
|
|
1999
1926
|
export const constructAnswerBasedOnData = (data: any) => {
|
|
2000
|
-
const answer: any = { data: [] };
|
|
2001
1927
|
if (Object.keys(data).find((dataKey) => dataKey === "orderingMaterialMap")) {
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
JSON.parse(JSON.stringify(data))
|
|
2006
|
-
)
|
|
1928
|
+
return constructActivityAnswerMap(
|
|
1929
|
+
{ type: "ORDERING" },
|
|
1930
|
+
JSON.parse(JSON.stringify(data))
|
|
2007
1931
|
);
|
|
2008
1932
|
}
|
|
2009
1933
|
if (Object.keys(data).find((dataKey) => dataKey === "dropdownMaterialMap")) {
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
JSON.parse(JSON.stringify(data))
|
|
2014
|
-
)
|
|
1934
|
+
return constructActivityAnswerMap(
|
|
1935
|
+
{ type: "DROPDOWN" },
|
|
1936
|
+
JSON.parse(JSON.stringify(data))
|
|
2015
1937
|
);
|
|
2016
1938
|
}
|
|
2017
1939
|
if (Object.keys(data).find((dataKey) => dataKey === "MCSAMaterialMap")) {
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
JSON.parse(JSON.stringify(data))
|
|
2022
|
-
)
|
|
1940
|
+
return constructActivityAnswerMap(
|
|
1941
|
+
{ type: "MCSA" },
|
|
1942
|
+
JSON.parse(JSON.stringify(data))
|
|
2023
1943
|
);
|
|
2024
1944
|
}
|
|
2025
1945
|
if (Object.keys(data).find((dataKey) => dataKey === "MCMAMaterialMap")) {
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
JSON.parse(JSON.stringify(data))
|
|
2030
|
-
)
|
|
1946
|
+
return constructActivityAnswerMap(
|
|
1947
|
+
{ type: "MCMA" },
|
|
1948
|
+
JSON.parse(JSON.stringify(data))
|
|
2031
1949
|
);
|
|
2032
1950
|
}
|
|
2033
1951
|
if (Object.keys(data).find((dataKey) => dataKey === "matchingMaterialMap")) {
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
JSON.parse(JSON.stringify(data))
|
|
2038
|
-
)
|
|
1952
|
+
return constructActivityAnswerMap(
|
|
1953
|
+
{ type: "MATCHING" },
|
|
1954
|
+
JSON.parse(JSON.stringify(data))
|
|
2039
1955
|
);
|
|
2040
1956
|
}
|
|
2041
1957
|
if (Object.keys(data).find((dataKey) => dataKey === "groupingMaterialMap")) {
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
JSON.parse(JSON.stringify(data))
|
|
2046
|
-
)
|
|
1958
|
+
return constructActivityAnswerMap(
|
|
1959
|
+
{ type: "GROUPING" },
|
|
1960
|
+
JSON.parse(JSON.stringify(data))
|
|
2047
1961
|
);
|
|
2048
1962
|
}
|
|
2049
1963
|
if (
|
|
@@ -2051,30 +1965,24 @@ export const constructAnswerBasedOnData = (data: any) => {
|
|
|
2051
1965
|
(dataKey) => dataKey === "fillInTheBlanksMaterialMap"
|
|
2052
1966
|
)
|
|
2053
1967
|
) {
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
JSON.parse(JSON.stringify(data))
|
|
2058
|
-
)
|
|
1968
|
+
return constructActivityAnswerMap(
|
|
1969
|
+
{ type: "FILL_IN_THE_BLANKS" },
|
|
1970
|
+
JSON.parse(JSON.stringify(data))
|
|
2059
1971
|
);
|
|
2060
1972
|
}
|
|
2061
1973
|
if (Object.keys(data).find((dataKey) => dataKey === "openEndedMaterialMap")) {
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
JSON.parse(JSON.stringify(data))
|
|
2066
|
-
)
|
|
1974
|
+
return constructActivityAnswerMap(
|
|
1975
|
+
{ type: "OPEN_ENDED" },
|
|
1976
|
+
JSON.parse(JSON.stringify(data))
|
|
2067
1977
|
);
|
|
2068
1978
|
}
|
|
2069
1979
|
if (Object.keys(data).find((dataKey) => dataKey === "trueFalseMaterialMap")) {
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
JSON.parse(JSON.stringify(data))
|
|
2074
|
-
)
|
|
1980
|
+
return constructActivityAnswerMap(
|
|
1981
|
+
{ type: "TRUE_FALSE" },
|
|
1982
|
+
JSON.parse(JSON.stringify(data))
|
|
2075
1983
|
);
|
|
2076
1984
|
}
|
|
2077
|
-
return
|
|
1985
|
+
return {};
|
|
2078
1986
|
};
|
|
2079
1987
|
|
|
2080
1988
|
export const constructActivityItemListBodyOnly = (bodyMap: any) => {
|