@nualang/nualang-ui-components 0.1.1301 → 0.1.1303
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.
|
@@ -892,10 +892,12 @@ function SectionList({
|
|
|
892
892
|
const [courseSectionWithProgress, setCourseSectionWithProgress] = useState([]);
|
|
893
893
|
useEffect(() => {
|
|
894
894
|
if (sections && memberCourseCompletions && selectedExercises) {
|
|
895
|
-
const sectionsWithProgress = calcCompletions(sections, memberCourseCompletions,
|
|
895
|
+
const sectionsWithProgress = calcCompletions(sections, memberCourseCompletions, selectedExercises, {
|
|
896
|
+
includeChallengeBots: isChallengeModeEnabled
|
|
897
|
+
});
|
|
896
898
|
setCourseSectionWithProgress(sectionsWithProgress);
|
|
897
899
|
}
|
|
898
|
-
}, [sections, memberCourseCompletions, selectedExercises]);
|
|
900
|
+
}, [sections, memberCourseCompletions, selectedExercises, isChallengeModeEnabled]);
|
|
899
901
|
const courseSections = courseSectionWithProgress && courseSectionWithProgress.length ? courseSectionWithProgress : sections;
|
|
900
902
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
901
903
|
children: courseSections.length > 0 ? courseSections.map((section, index) => {
|
|
@@ -663,6 +663,7 @@ function Progress({
|
|
|
663
663
|
bots: bots,
|
|
664
664
|
courseIds: courseIds,
|
|
665
665
|
featureFlags: featureFlags,
|
|
666
|
+
reportType: reportType,
|
|
666
667
|
isChallengeModeEnabled: Array.isArray(featureFlags?.classroomModes) && featureFlags.classroomModes.includes("challenge"),
|
|
667
668
|
assignedCourseIds: assignedCourseIds
|
|
668
669
|
})]
|
package/dist/utils/index.js
CHANGED
|
@@ -127,7 +127,6 @@ export const getScoreValues = (type, id, completions) => {
|
|
|
127
127
|
}
|
|
128
128
|
};
|
|
129
129
|
export const calcTopicCompletions = (topic, completions = [], isSectionHidden, assignmentExercises = [], includeChallengeBots = false) => {
|
|
130
|
-
// console.log({ assignmentExercises, includeChallengeBots, completions, topic });
|
|
131
130
|
let isRoleplaysHidden;
|
|
132
131
|
let isPronunciationHidden;
|
|
133
132
|
let isBotsHidden;
|
|
@@ -140,11 +139,6 @@ export const calcTopicCompletions = (topic, completions = [], isSectionHidden, a
|
|
|
140
139
|
isPhrases = true;
|
|
141
140
|
}
|
|
142
141
|
if (isSectionHidden || topic.isTopicHidden) {
|
|
143
|
-
console.log({
|
|
144
|
-
itHAppened: topic,
|
|
145
|
-
isSectionHidden,
|
|
146
|
-
topicIsHidden: topic.isTopicHidden
|
|
147
|
-
});
|
|
148
142
|
isRoleplaysHidden = true;
|
|
149
143
|
isBotsHidden = true;
|
|
150
144
|
isPronunciationHidden = true;
|
|
@@ -167,9 +161,6 @@ export const calcTopicCompletions = (topic, completions = [], isSectionHidden, a
|
|
|
167
161
|
});
|
|
168
162
|
} else if (topic && topic.hiddenExercises) {
|
|
169
163
|
topic.hiddenExercises.forEach(exercise => {
|
|
170
|
-
console.log({
|
|
171
|
-
happenedHEREE: exercise
|
|
172
|
-
});
|
|
173
164
|
if (exercise === "roleplays") {
|
|
174
165
|
isRoleplaysHidden = true;
|
|
175
166
|
}
|
|
@@ -201,44 +192,21 @@ export const calcTopicCompletions = (topic, completions = [], isSectionHidden, a
|
|
|
201
192
|
const completedPronunciation = Array.isArray(completions) ? completions.filter(c => c.topicId === topic.topicId && c.exercise === "pronunciation").length : 0;
|
|
202
193
|
const completedTranslation = Array.isArray(completions) ? completions.filter(c => c.topicId === topic.topicId && c.exercise === "translation").length : 0;
|
|
203
194
|
const completedListening = Array.isArray(completions) ? completions.filter(c => c.topicId === topic.topicId && c.exercise === "listening").length : 0;
|
|
204
|
-
console.log({
|
|
205
|
-
topic,
|
|
206
|
-
completedTranslation,
|
|
207
|
-
completedListening,
|
|
208
|
-
isPronunciationHidden,
|
|
209
|
-
isTranslationHidden,
|
|
210
|
-
isListeningHidden
|
|
211
|
-
});
|
|
212
195
|
completedExerciseCount += !isPronunciationHidden && completedPronunciation > 0 ? 1 : 0;
|
|
213
196
|
completedExerciseCount += !isTranslationHidden && completedTranslation > 0 ? 1 : 0;
|
|
214
197
|
completedExerciseCount += !isListeningHidden && completedListening > 0 ? 1 : 0;
|
|
215
|
-
console.log({
|
|
216
|
-
completedTranslation,
|
|
217
|
-
isTranslationHidden,
|
|
218
|
-
completedExerciseCount
|
|
219
|
-
});
|
|
220
|
-
// console.log({ completedPronunciation, completedTranslation, completedListening, completedExerciseCount, totalExercises });
|
|
221
198
|
let completedRoleplays = 0;
|
|
222
199
|
let completedGames = 0;
|
|
223
200
|
let totalNumberOfGames = 0;
|
|
224
201
|
let completedBots = 0;
|
|
225
202
|
const roleplays = topic.roleplays.map(roleplay => {
|
|
226
203
|
const isUnassignedRoleplay = assignmentExercises ? assignmentExercises && !assignmentExercises.some(e => e.roleplayId === roleplay.roleplayId) : false;
|
|
227
|
-
console.log({
|
|
228
|
-
assignmentExercises,
|
|
229
|
-
roleplay,
|
|
230
|
-
isRoleplaysHidden,
|
|
231
|
-
isSectionHidden,
|
|
232
|
-
topicIsHidden: topic.isTopicHidden,
|
|
233
|
-
isUnassignedRoleplay
|
|
234
|
-
});
|
|
235
204
|
if (isRoleplaysHidden || roleplay.isRoleplayHidden || isSectionHidden || topic.isTopicHidden || isUnassignedRoleplay) {
|
|
236
205
|
return {
|
|
237
206
|
...roleplay,
|
|
238
207
|
completedCount: 0
|
|
239
208
|
};
|
|
240
209
|
}
|
|
241
|
-
// console.log({ uiCompletions: completions })
|
|
242
210
|
const roleplayCompletions = Array.isArray(completions) ? completions.filter(completion => completion.gameId && completion.roleplayId === roleplay.roleplayId) : [];
|
|
243
211
|
let numberOfRoleplayExercises = 0;
|
|
244
212
|
let numberOfCompletedRoleplayExercises = 0;
|
|
@@ -280,10 +248,6 @@ export const calcTopicCompletions = (topic, completions = [], isSectionHidden, a
|
|
|
280
248
|
totalExercises++;
|
|
281
249
|
const completedCount = Array.isArray(roleplayCompletions) ? roleplayCompletions.filter(c => c.exercise === name).length : 0;
|
|
282
250
|
if (completedCount > 0) {
|
|
283
|
-
console.log({
|
|
284
|
-
name,
|
|
285
|
-
completedCount
|
|
286
|
-
});
|
|
287
251
|
numberOfCompletedRoleplayExercises++;
|
|
288
252
|
completedGames++;
|
|
289
253
|
completedExerciseCount++;
|
|
@@ -299,21 +263,8 @@ export const calcTopicCompletions = (topic, completions = [], isSectionHidden, a
|
|
|
299
263
|
};
|
|
300
264
|
});
|
|
301
265
|
const bots = topic.bots.map(bot => {
|
|
302
|
-
console.log({
|
|
303
|
-
completions
|
|
304
|
-
});
|
|
305
266
|
const isUnassignedBot = assignmentExercises ? assignmentExercises && !assignmentExercises.some(e => e.botId === bot.botId) : false;
|
|
306
|
-
if (isBotsHidden || bot.isBotHidden || bot.isChallengeBot && !includeChallengeBots || isSectionHidden || topic.isTopicHidden
|
|
307
|
-
// ||
|
|
308
|
-
// isUnassignedBot
|
|
309
|
-
) {
|
|
310
|
-
// console.log({ itHAppened: bot, })
|
|
311
|
-
// console.log({ isBotsHidden ,
|
|
312
|
-
// ishiddne: bot.isBotHidden ,
|
|
313
|
-
// mine: (bot.isChallengeBot && !includeChallengeBots),
|
|
314
|
-
// isSectionHidden ,
|
|
315
|
-
// topichidden: topic.isTopicHidden ,
|
|
316
|
-
// isUnassignedBot });
|
|
267
|
+
if (isBotsHidden || bot.isBotHidden || bot.isChallengeBot && !includeChallengeBots || isSectionHidden || topic.isTopicHidden || isUnassignedBot) {
|
|
317
268
|
return {
|
|
318
269
|
...bot,
|
|
319
270
|
completedCount: 0
|
|
@@ -389,7 +340,7 @@ export const calcTopicCompletions = (topic, completions = [], isSectionHidden, a
|
|
|
389
340
|
}
|
|
390
341
|
};
|
|
391
342
|
};
|
|
392
|
-
export const calcCompletions = (sections = [], completions = [], assignmentExercises, opts = {}) => sections.map(section => {
|
|
343
|
+
export const calcCompletions = (sections = [], completions = [], assignmentExercises = [], opts = {}) => sections.map(section => {
|
|
393
344
|
const {
|
|
394
345
|
includeChallengeBots = false
|
|
395
346
|
} = opts;
|