@nualang/nualang-ui-components 0.1.1303 → 0.1.1305
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/Assignments/AssignmentCourseSelection/AssignmentCourseSelection.js +1 -6
- package/dist/Assignments/AssignmentExerciseSelection/AssignmentExerciseSelection.js +3 -9
- package/dist/Assignments/AssignmentExerciseSelector/AssignmentExerciseSelector.js +0 -2
- package/dist/Assignments/AssignmentSelectExercise/AssignmentSelectExercise.js +0 -2
- package/dist/Assignments/CreateAssignmentDialog/CreateAssignmentDialog.js +3 -6
- package/dist/Lists/CourseOutline/CourseOutline.js +11 -26
- package/dist/Screens/Classrooms/ViewClassroom/ViewClassroom.js +0 -2
- package/dist/Screens/Courses/ViewCourse/ViewCourse.js +3 -1
- package/dist/Screens/Courses/ViewCourse/ViewTopic/ViewTopic.js +2 -2
- package/dist/Tables/Progress/Progress.js +0 -1
- package/dist/Tables/Progress/ProgressTable.js +24 -16
- package/dist/Tables/Progress/utils.js +4 -4
- package/dist/utils/index.js +6 -29
- package/package.json +1 -1
|
@@ -31,7 +31,6 @@ function Course({
|
|
|
31
31
|
lastClickedExerciseId,
|
|
32
32
|
handleRemoveExercise,
|
|
33
33
|
isPreview,
|
|
34
|
-
isChallengeModeEnabled = false,
|
|
35
34
|
isChallengeModeStudent
|
|
36
35
|
}) {
|
|
37
36
|
const numOfIds = lastClickedExerciseId ? lastClickedExerciseId.split("|") : [];
|
|
@@ -88,7 +87,7 @@ function Course({
|
|
|
88
87
|
}
|
|
89
88
|
});
|
|
90
89
|
if (courseSections && memberCourseCompletions && selectedExercises) {
|
|
91
|
-
const sectionsWithProgress = calcCompletions(courseSections.filter(section => assignedSectionIds.has(section.sectionId)), memberCourseCompletions, selectedExercises,
|
|
90
|
+
const sectionsWithProgress = calcCompletions(courseSections.filter(section => assignedSectionIds.has(section.sectionId)), memberCourseCompletions, selectedExercises, isChallengeModeStudent);
|
|
92
91
|
const percentCompletion = calcPercentageCompletion(sectionsWithProgress);
|
|
93
92
|
setCourseSectionCompletion(percentCompletion);
|
|
94
93
|
}
|
|
@@ -177,7 +176,6 @@ function Course({
|
|
|
177
176
|
progressHelpers: progressHelpers,
|
|
178
177
|
memberCourseCompletions: memberCourseCompletions,
|
|
179
178
|
lastClickedExerciseId: lastClickedExerciseId,
|
|
180
|
-
isChallengeModeEnabled: isChallengeModeEnabled,
|
|
181
179
|
isChallengeModeStudent: isChallengeModeStudent
|
|
182
180
|
})
|
|
183
181
|
})
|
|
@@ -208,7 +206,6 @@ function Course({
|
|
|
208
206
|
course: course,
|
|
209
207
|
handleRemoveExercise: handleRemoveExercise,
|
|
210
208
|
isPreview: isPreview,
|
|
211
|
-
isChallengeModeEnabled: isChallengeModeEnabled,
|
|
212
209
|
isChallengeModeStudent: isChallengeModeStudent
|
|
213
210
|
})
|
|
214
211
|
})
|
|
@@ -236,7 +233,6 @@ function AssignmentCourseSelection({
|
|
|
236
233
|
lastClickedExerciseId,
|
|
237
234
|
handleRemoveExercise,
|
|
238
235
|
isPreview,
|
|
239
|
-
isChallengeModeEnabled = false,
|
|
240
236
|
isChallengeModeStudent,
|
|
241
237
|
...otherProps
|
|
242
238
|
}) {
|
|
@@ -264,7 +260,6 @@ function AssignmentCourseSelection({
|
|
|
264
260
|
lastClickedExerciseId: lastClickedExerciseId,
|
|
265
261
|
handleRemoveExercise: handleRemoveExercise,
|
|
266
262
|
isPreview: isPreview,
|
|
267
|
-
isChallengeModeEnabled: isChallengeModeEnabled,
|
|
268
263
|
isChallengeModeStudent: isChallengeModeStudent
|
|
269
264
|
}, course.courseId || index))
|
|
270
265
|
});
|
|
@@ -48,7 +48,6 @@ function Exercise({
|
|
|
48
48
|
lastClickedExerciseId,
|
|
49
49
|
isPreview,
|
|
50
50
|
handleRemoveExercise = null,
|
|
51
|
-
isChallengeModeEnabled = false,
|
|
52
51
|
isChallengeModeStudent
|
|
53
52
|
}) {
|
|
54
53
|
const [listeningHidden, setListeningHidden] = useState(false);
|
|
@@ -269,8 +268,7 @@ function Exercise({
|
|
|
269
268
|
isCreator: isCreator,
|
|
270
269
|
lastClickedExerciseId: lastClickedExerciseId,
|
|
271
270
|
handleRemoveExercise: handleRemoveExercise,
|
|
272
|
-
isPreview: isPreview
|
|
273
|
-
isChallengeModeEnabled: isChallengeModeEnabled
|
|
271
|
+
isPreview: isPreview
|
|
274
272
|
})
|
|
275
273
|
})
|
|
276
274
|
}), name.toLowerCase() === "bots" && /*#__PURE__*/_jsx(Collapse, {
|
|
@@ -298,7 +296,6 @@ function Exercise({
|
|
|
298
296
|
lastClickedExerciseId: lastClickedExerciseId,
|
|
299
297
|
handleRemoveExercise: handleRemoveExercise,
|
|
300
298
|
isPreview: isPreview,
|
|
301
|
-
isChallengeModeEnabled: isChallengeModeEnabled,
|
|
302
299
|
isChallengeModeStudent: isChallengeModeStudent
|
|
303
300
|
})
|
|
304
301
|
})
|
|
@@ -885,19 +882,16 @@ function SectionList({
|
|
|
885
882
|
course,
|
|
886
883
|
handleRemoveExercise,
|
|
887
884
|
isPreview,
|
|
888
|
-
isChallengeModeEnabled = false,
|
|
889
885
|
isChallengeModeStudent,
|
|
890
886
|
...otherProps
|
|
891
887
|
}) {
|
|
892
888
|
const [courseSectionWithProgress, setCourseSectionWithProgress] = useState([]);
|
|
893
889
|
useEffect(() => {
|
|
894
890
|
if (sections && memberCourseCompletions && selectedExercises) {
|
|
895
|
-
const sectionsWithProgress = calcCompletions(sections, memberCourseCompletions, selectedExercises,
|
|
896
|
-
includeChallengeBots: isChallengeModeEnabled
|
|
897
|
-
});
|
|
891
|
+
const sectionsWithProgress = calcCompletions(sections, memberCourseCompletions, selectedExercises, isChallengeModeStudent);
|
|
898
892
|
setCourseSectionWithProgress(sectionsWithProgress);
|
|
899
893
|
}
|
|
900
|
-
}, [sections, memberCourseCompletions, selectedExercises,
|
|
894
|
+
}, [sections, memberCourseCompletions, selectedExercises, isChallengeModeStudent]);
|
|
901
895
|
const courseSections = courseSectionWithProgress && courseSectionWithProgress.length ? courseSectionWithProgress : sections;
|
|
902
896
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
903
897
|
children: courseSections.length > 0 ? courseSections.map((section, index) => {
|
|
@@ -20,7 +20,6 @@ function AssignmentExerciseSelector({
|
|
|
20
20
|
lastClickedExerciseId,
|
|
21
21
|
handleRemoveExercise,
|
|
22
22
|
isPreview,
|
|
23
|
-
isChallengeModeEnabled = false,
|
|
24
23
|
isChallengeModeStudent
|
|
25
24
|
}) {
|
|
26
25
|
return /*#__PURE__*/_jsx(Box, {
|
|
@@ -43,7 +42,6 @@ function AssignmentExerciseSelector({
|
|
|
43
42
|
lastClickedExerciseId: lastClickedExerciseId,
|
|
44
43
|
handleRemoveExercise: handleRemoveExercise,
|
|
45
44
|
isPreview: isPreview,
|
|
46
|
-
isChallengeModeEnabled: isChallengeModeEnabled,
|
|
47
45
|
isChallengeModeStudent: isChallengeModeStudent
|
|
48
46
|
})
|
|
49
47
|
});
|
|
@@ -20,7 +20,6 @@ function AssignmentSelectExercise({
|
|
|
20
20
|
preferred_username,
|
|
21
21
|
progressHelpers,
|
|
22
22
|
memberCourseCompletions,
|
|
23
|
-
isChallengeModeEnabled = false,
|
|
24
23
|
isChallengeModeStudent
|
|
25
24
|
}) {
|
|
26
25
|
const [isExerciseSelected, setIsExerciseSelected] = useState(false);
|
|
@@ -94,7 +93,6 @@ function AssignmentSelectExercise({
|
|
|
94
93
|
preferred_username: preferred_username,
|
|
95
94
|
progressHelpers: progressHelpers,
|
|
96
95
|
memberCourseCompletions: memberCourseCompletions,
|
|
97
|
-
isChallengeModeEnabled: isChallengeModeEnabled,
|
|
98
96
|
isChallengeModeStudent: isChallengeModeStudent
|
|
99
97
|
})
|
|
100
98
|
})]
|
|
@@ -50,8 +50,7 @@ export default function CreateAssignmentDialog({
|
|
|
50
50
|
initialData = {},
|
|
51
51
|
dialogTitle,
|
|
52
52
|
userEmail = "",
|
|
53
|
-
assignedStudents
|
|
54
|
-
isChallengeModeEnabled = false
|
|
53
|
+
assignedStudents
|
|
55
54
|
}) {
|
|
56
55
|
const {
|
|
57
56
|
classes
|
|
@@ -447,8 +446,7 @@ export default function CreateAssignmentDialog({
|
|
|
447
446
|
viewOnly: true,
|
|
448
447
|
useCase: "assignment-view",
|
|
449
448
|
handleRemoveExercise: handleRemoveExercise,
|
|
450
|
-
isPreview: true
|
|
451
|
-
isChallengeModeEnabled: isChallengeModeEnabled
|
|
449
|
+
isPreview: true
|
|
452
450
|
})]
|
|
453
451
|
})
|
|
454
452
|
}), /*#__PURE__*/_jsx(Card, {
|
|
@@ -637,8 +635,7 @@ export default function CreateAssignmentDialog({
|
|
|
637
635
|
useCase: "assignment-select",
|
|
638
636
|
selectedExercises: selectedExercises,
|
|
639
637
|
setSelectedExercises: setSelectedExercises,
|
|
640
|
-
setSubmittedExercises: setSubmittedExercises
|
|
641
|
-
isChallengeModeEnabled: isChallengeModeEnabled
|
|
638
|
+
setSubmittedExercises: setSubmittedExercises
|
|
642
639
|
})]
|
|
643
640
|
});
|
|
644
641
|
}
|
|
@@ -1149,7 +1149,7 @@ function CourseOutline({
|
|
|
1149
1149
|
showViewTopicButton = true,
|
|
1150
1150
|
isClassroomArchived = false,
|
|
1151
1151
|
classroomId,
|
|
1152
|
-
|
|
1152
|
+
isChallengeModeStudent = false,
|
|
1153
1153
|
...otherProps
|
|
1154
1154
|
}) {
|
|
1155
1155
|
const [percentageCompletion, setPercentageCompletion] = useState({
|
|
@@ -1160,11 +1160,19 @@ function CourseOutline({
|
|
|
1160
1160
|
const [sects, setSects] = useState([]);
|
|
1161
1161
|
useEffect(() => {
|
|
1162
1162
|
if (isMember) {
|
|
1163
|
-
|
|
1163
|
+
const sectionsWithProgress = calcCompletions(sections, completions, null, isChallengeModeStudent);
|
|
1164
|
+
const percentCompletion = calcPercentageCompletion(sectionsWithProgress);
|
|
1165
|
+
setSects(sectionsWithProgress);
|
|
1166
|
+
setPercentageCompletion(percentCompletion);
|
|
1164
1167
|
} else {
|
|
1165
1168
|
setSects(sections);
|
|
1169
|
+
setPercentageCompletion({
|
|
1170
|
+
completed: 0,
|
|
1171
|
+
total: 0,
|
|
1172
|
+
percentage: 0
|
|
1173
|
+
});
|
|
1166
1174
|
}
|
|
1167
|
-
}, [isMember, JSON.stringify(sections), JSON.stringify(completions)]);
|
|
1175
|
+
}, [isMember, isChallengeModeStudent, JSON.stringify(sections), JSON.stringify(completions)]);
|
|
1168
1176
|
const moveSection = useCallback((dragIndex, hoverIndex) => {
|
|
1169
1177
|
const dragSection = sects[dragIndex];
|
|
1170
1178
|
const newSections = update(sects, {
|
|
@@ -1191,29 +1199,6 @@ function CourseOutline({
|
|
|
1191
1199
|
});
|
|
1192
1200
|
setSects(newSections);
|
|
1193
1201
|
}, [sects]);
|
|
1194
|
-
useEffect(() => {
|
|
1195
|
-
if (isMember) {
|
|
1196
|
-
const sectionsWithProgress = calcCompletions(sections, completions, [], {
|
|
1197
|
-
includeChallengeBots: isChallengeModeEnabled
|
|
1198
|
-
});
|
|
1199
|
-
console.log({
|
|
1200
|
-
sectionsWithProgress
|
|
1201
|
-
});
|
|
1202
|
-
const percentCompletion = calcPercentageCompletion(sectionsWithProgress);
|
|
1203
|
-
console.log({
|
|
1204
|
-
percentCompletion
|
|
1205
|
-
});
|
|
1206
|
-
setSects(sectionsWithProgress);
|
|
1207
|
-
setPercentageCompletion(percentCompletion);
|
|
1208
|
-
} else {
|
|
1209
|
-
setSects(sections);
|
|
1210
|
-
setPercentageCompletion({
|
|
1211
|
-
completed: 0,
|
|
1212
|
-
total: 0,
|
|
1213
|
-
percentage: 0
|
|
1214
|
-
});
|
|
1215
|
-
}
|
|
1216
|
-
}, [completions, isMember, sections, isChallengeModeEnabled]);
|
|
1217
1202
|
const {
|
|
1218
1203
|
percentage,
|
|
1219
1204
|
completed,
|
|
@@ -494,7 +494,6 @@ function Classroom({
|
|
|
494
494
|
assignmentMembersById,
|
|
495
495
|
email,
|
|
496
496
|
isLoadingAssignments,
|
|
497
|
-
isChallengeModeEnabled = false,
|
|
498
497
|
isChallengeModeStudent,
|
|
499
498
|
...otherProps
|
|
500
499
|
}) {
|
|
@@ -1132,7 +1131,6 @@ function Classroom({
|
|
|
1132
1131
|
submissions: submissionsTableData,
|
|
1133
1132
|
featureFlags: featureFlags,
|
|
1134
1133
|
isVideoChatEnabled: isVideoChatEnabled && isVideoChatEnabledInSettings,
|
|
1135
|
-
isChallengeModeEnabled: isChallengeModeEnabled,
|
|
1136
1134
|
assignedCourses: assignedCourses,
|
|
1137
1135
|
assignedCourseIds: assignedCourseIds
|
|
1138
1136
|
})
|
|
@@ -326,6 +326,7 @@ function Course({
|
|
|
326
326
|
classroomId,
|
|
327
327
|
loading,
|
|
328
328
|
featureFlags,
|
|
329
|
+
isChallengeModeStudent,
|
|
329
330
|
...otherProps
|
|
330
331
|
}) {
|
|
331
332
|
const {
|
|
@@ -646,7 +647,8 @@ function Course({
|
|
|
646
647
|
isLoading: isSectionsLoading,
|
|
647
648
|
courseSettings: courseSettings,
|
|
648
649
|
verificationStatus: verificationStatus,
|
|
649
|
-
handleDeletePDF: handleDeleteSectionPDF
|
|
650
|
+
handleDeletePDF: handleDeleteSectionPDF,
|
|
651
|
+
isChallengeModeStudent: isChallengeModeStudent
|
|
650
652
|
})
|
|
651
653
|
})
|
|
652
654
|
}), !isLoading && !isSectionsLoading && sections.length === 0 && /*#__PURE__*/_jsx(SectionsNotFound, {
|
|
@@ -532,14 +532,14 @@ function Topic({
|
|
|
532
532
|
const [isUploadPhrasesDialogOpen, setIsUploadPhrasesDialogOpen] = useState(false);
|
|
533
533
|
const topicCompletion = useMemo(() => {
|
|
534
534
|
if (isMember && topic?.topicId && topic?.completions?.length) {
|
|
535
|
-
return calcTopicCompletions(topic, topic.completions, false).completion;
|
|
535
|
+
return calcTopicCompletions(topic, topic.completions, false, null, isChallengeModeStudent).completion;
|
|
536
536
|
}
|
|
537
537
|
return {
|
|
538
538
|
completed: 0,
|
|
539
539
|
total: 0,
|
|
540
540
|
percentage: 0
|
|
541
541
|
};
|
|
542
|
-
}, [isMember, topic?.topicId, topic?.completions?.length]);
|
|
542
|
+
}, [isMember, topic?.topicId, topic?.completions?.length, isChallengeModeStudent]);
|
|
543
543
|
const {
|
|
544
544
|
percentage,
|
|
545
545
|
completed,
|
|
@@ -664,7 +664,6 @@ function Progress({
|
|
|
664
664
|
courseIds: courseIds,
|
|
665
665
|
featureFlags: featureFlags,
|
|
666
666
|
reportType: reportType,
|
|
667
|
-
isChallengeModeEnabled: Array.isArray(featureFlags?.classroomModes) && featureFlags.classroomModes.includes("challenge"),
|
|
668
667
|
assignedCourseIds: assignedCourseIds
|
|
669
668
|
})]
|
|
670
669
|
});
|
|
@@ -461,6 +461,7 @@ function ExerciseCellData({
|
|
|
461
461
|
topicId,
|
|
462
462
|
memberId,
|
|
463
463
|
roleplayId,
|
|
464
|
+
botId,
|
|
464
465
|
index
|
|
465
466
|
}) {
|
|
466
467
|
if (isLoading) {
|
|
@@ -476,7 +477,14 @@ function ExerciseCellData({
|
|
|
476
477
|
index: index
|
|
477
478
|
});
|
|
478
479
|
} else {
|
|
479
|
-
let completions =
|
|
480
|
+
let completions = null;
|
|
481
|
+
if (exercise === "roleplays") {
|
|
482
|
+
completions = data?.completions.filter(completion => completion.exercise.startsWith("roleplay") && completion.roleplayId === roleplayId);
|
|
483
|
+
} else if (exercise === "bots") {
|
|
484
|
+
completions = data?.completions.filter(completion => completion.exercise === "bot" && completion.botId === botId);
|
|
485
|
+
} else {
|
|
486
|
+
completions = data?.completions.filter(completion => completion.exercise === exercise);
|
|
487
|
+
}
|
|
480
488
|
let icon = null;
|
|
481
489
|
let type = null;
|
|
482
490
|
let color;
|
|
@@ -499,8 +507,9 @@ function ExerciseCellData({
|
|
|
499
507
|
default:
|
|
500
508
|
color = grey[400];
|
|
501
509
|
}
|
|
502
|
-
} else if (exercise === "bots" &&
|
|
503
|
-
|
|
510
|
+
} else if (exercise === "bots" && botId && completions?.length > 0) {
|
|
511
|
+
const botCompletionData = data?.percentComplete["bots"].completedCounts.find(c => c.botId === botId);
|
|
512
|
+
if (botCompletionData?.completedCount > 0) {
|
|
504
513
|
icon = /*#__PURE__*/_jsx(DoneIcon, {});
|
|
505
514
|
type = "completed";
|
|
506
515
|
} else {
|
|
@@ -592,12 +601,13 @@ function TableRow({
|
|
|
592
601
|
tableBots,
|
|
593
602
|
tableTopics,
|
|
594
603
|
assignments,
|
|
595
|
-
courseIds
|
|
596
|
-
isChallengeModeEnabled = false
|
|
604
|
+
courseIds
|
|
597
605
|
}) {
|
|
598
606
|
const {
|
|
599
|
-
memberId
|
|
607
|
+
memberId,
|
|
608
|
+
assignedLabels
|
|
600
609
|
} = member;
|
|
610
|
+
const isChallengeModeStudent = assignedLabels?.isChallengeModeStudent;
|
|
601
611
|
const memberCourseCompletionsQuery = useQuery({
|
|
602
612
|
queryKey: ["memberCourseProgress", memberId, courseIds],
|
|
603
613
|
queryFn: async () => {
|
|
@@ -611,8 +621,8 @@ function TableRow({
|
|
|
611
621
|
error,
|
|
612
622
|
isLoading
|
|
613
623
|
} = memberCourseCompletionsQuery;
|
|
614
|
-
const tableData = useMemo(() => memberCourseCompletionsQuery.isSuccess && Array.isArray(memberCourseCompletionsQuery.data.Items) && memberCourseCompletionsQuery.data.Items.length ? formatMemberCourseCompletions(courses, memberCourseCompletionsQuery.data.Items, reportType === "assignments" && selectedAssignment ? selectedAssignment?.exercises : null,
|
|
615
|
-
const assignmentsTableData = useMemo(() => memberCourseCompletionsQuery.isSuccess && Array.isArray(memberCourseCompletionsQuery.data.Items) && memberCourseCompletionsQuery.data.Items.length && assignments && assignments.length ? formatMemberAssignmentCompletions(assignments, courses, memberCourseCompletionsQuery.data.Items,
|
|
624
|
+
const tableData = useMemo(() => memberCourseCompletionsQuery.isSuccess && Array.isArray(memberCourseCompletionsQuery.data.Items) && memberCourseCompletionsQuery.data.Items.length ? formatMemberCourseCompletions(courses, memberCourseCompletionsQuery.data.Items, reportType === "assignments" && selectedAssignment ? selectedAssignment?.exercises : null, isChallengeModeStudent) : [], [memberCourseCompletionsQuery.data, memberCourseCompletionsQuery.isSuccess, reportType, selectedAssignment, isChallengeModeStudent]);
|
|
625
|
+
const assignmentsTableData = useMemo(() => memberCourseCompletionsQuery.isSuccess && Array.isArray(memberCourseCompletionsQuery.data.Items) && memberCourseCompletionsQuery.data.Items.length && assignments && assignments.length ? formatMemberAssignmentCompletions(assignments, courses, memberCourseCompletionsQuery.data.Items, isChallengeModeStudent) : [], [memberCourseCompletionsQuery.data, memberCourseCompletionsQuery.isSuccess, assignments, isChallengeModeStudent]);
|
|
616
626
|
let memberActivityLink = `/classrooms/${classroomId}/activity/member/${member.memberId}`;
|
|
617
627
|
if (currentView === "course") {
|
|
618
628
|
memberActivityLink = `${memberActivityLink}/${selectedCourse.courseId}`;
|
|
@@ -887,8 +897,7 @@ function ProgressTable({
|
|
|
887
897
|
courseIds,
|
|
888
898
|
featureFlags,
|
|
889
899
|
reportType,
|
|
890
|
-
assignedCourseIds
|
|
891
|
-
isChallengeModeEnabled = false
|
|
900
|
+
assignedCourseIds
|
|
892
901
|
}) {
|
|
893
902
|
const selectedAssignmentTopics = (selectedAssignment?.exercises || [])?.map(e => e.courseSectionTopicId);
|
|
894
903
|
const currentCourseIds = reportType === "assignments" ? assignedCourseIds : courseIds;
|
|
@@ -929,12 +938,12 @@ function ProgressTable({
|
|
|
929
938
|
const aCompletions = queryClient.getQueryData(["memberCourseProgress", a.memberId, currentCourseIds]).Items;
|
|
930
939
|
const bCompletions = queryClient.getQueryData(["memberCourseProgress", b.memberId, currentCourseIds]).Items;
|
|
931
940
|
if (currentView === "assignments") {
|
|
932
|
-
a.completions = formatMemberAssignmentCompletions(courses, aCompletions, assignmentExercises,
|
|
933
|
-
b.completions = formatMemberAssignmentCompletions(courses, bCompletions, assignmentExercises,
|
|
941
|
+
a.completions = formatMemberAssignmentCompletions(courses, aCompletions, assignmentExercises, a?.assignedLabels?.isChallengeModeStudent);
|
|
942
|
+
b.completions = formatMemberAssignmentCompletions(courses, bCompletions, assignmentExercises, b?.assignedLabels?.isChallengeModeStudent);
|
|
934
943
|
} else {
|
|
935
944
|
const assignmentExercises = reportType === "assignments" && selectedAssignment ? selectedAssignment?.exercises : null;
|
|
936
|
-
a.completions = formatMemberCourseCompletions(courses, aCompletions, assignmentExercises,
|
|
937
|
-
b.completions = formatMemberCourseCompletions(courses, bCompletions, assignmentExercises,
|
|
945
|
+
a.completions = formatMemberCourseCompletions(courses, aCompletions, assignmentExercises, a?.assignedLabels?.isChallengeModeStudent);
|
|
946
|
+
b.completions = formatMemberCourseCompletions(courses, bCompletions, assignmentExercises, b?.assignedLabels?.isChallengeModeStudent);
|
|
938
947
|
}
|
|
939
948
|
if (currentView === "all_courses" || currentView === "assignments") {
|
|
940
949
|
a1 = a.completions[property][percentageAccessor].percentage;
|
|
@@ -1635,8 +1644,7 @@ function ProgressTable({
|
|
|
1635
1644
|
tableBots: tableBots,
|
|
1636
1645
|
tableTopics: tableTopics,
|
|
1637
1646
|
assignments: assignments,
|
|
1638
|
-
courseIds: currentCourseIds
|
|
1639
|
-
isChallengeModeEnabled: isChallengeModeEnabled
|
|
1647
|
+
courseIds: currentCourseIds
|
|
1640
1648
|
}, `student-progress-table-row-${i}`))
|
|
1641
1649
|
})]
|
|
1642
1650
|
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { calcCompletions, calcPercentageCompletion, getScoreValues } from "../../utils";
|
|
2
|
-
export const formatMemberCourseCompletions = (courses = [], completions = [], assignmentExercises,
|
|
2
|
+
export const formatMemberCourseCompletions = (courses = [], completions = [], assignmentExercises, isChallengeModeStudent = false) => {
|
|
3
3
|
const initialStatsObject = courses.reduce((obj, v) => {
|
|
4
4
|
const scoreValues = getScoreValues("course", v.courseId, completions);
|
|
5
5
|
obj[v.courseId] = {
|
|
@@ -17,7 +17,7 @@ export const formatMemberCourseCompletions = (courses = [], completions = [], as
|
|
|
17
17
|
return obj;
|
|
18
18
|
}, {});
|
|
19
19
|
const stats = courses.reduce((previousValue, currentValue) => {
|
|
20
|
-
const sectionsWithProgress = calcCompletions(currentValue.sections, completions, assignmentExercises,
|
|
20
|
+
const sectionsWithProgress = calcCompletions(currentValue.sections, completions, assignmentExercises, isChallengeModeStudent);
|
|
21
21
|
const percentCompletion = calcPercentageCompletion(sectionsWithProgress);
|
|
22
22
|
previousValue[currentValue.courseId].percentComplete = percentCompletion;
|
|
23
23
|
const initialSectionsObject = sectionsWithProgress.reduce((sectionObj, sectionVal) => {
|
|
@@ -81,7 +81,7 @@ export const formatMemberCourseCompletions = (courses = [], completions = [], as
|
|
|
81
81
|
}, initialStatsObject);
|
|
82
82
|
return stats;
|
|
83
83
|
};
|
|
84
|
-
export const formatMemberAssignmentCompletions = (assignments = [], courses = [], completions = [],
|
|
84
|
+
export const formatMemberAssignmentCompletions = (assignments = [], courses = [], completions = [], isChallengeModeStudent = false) => {
|
|
85
85
|
const stats = assignments.reduce((obj, assignment) => {
|
|
86
86
|
const assignmentCompletions = completions.filter(completion => assignment.exercises?.some(e => {
|
|
87
87
|
if (e.name && completion.exercise !== e.name) return false;
|
|
@@ -90,7 +90,7 @@ export const formatMemberAssignmentCompletions = (assignments = [], courses = []
|
|
|
90
90
|
if (e.courseSectionTopicId && `${completion.courseSectionId}|${completion.topicId}` !== e.courseSectionTopicId) return false;
|
|
91
91
|
return true;
|
|
92
92
|
}));
|
|
93
|
-
const assignmentCourseCompletions = formatMemberCourseCompletions(courses, assignmentCompletions, assignment?.exercises,
|
|
93
|
+
const assignmentCourseCompletions = formatMemberCourseCompletions(courses, assignmentCompletions, assignment?.exercises, isChallengeModeStudent);
|
|
94
94
|
const accumulator = {
|
|
95
95
|
percentComplete: {
|
|
96
96
|
completed: 0,
|
package/dist/utils/index.js
CHANGED
|
@@ -126,7 +126,7 @@ export const getScoreValues = (type, id, completions) => {
|
|
|
126
126
|
}, avgPronunciationScore];
|
|
127
127
|
}
|
|
128
128
|
};
|
|
129
|
-
export const calcTopicCompletions = (topic, completions = [], isSectionHidden, assignmentExercises
|
|
129
|
+
export const calcTopicCompletions = (topic, completions = [], isSectionHidden, assignmentExercises, includeChallengeBots = false) => {
|
|
130
130
|
let isRoleplaysHidden;
|
|
131
131
|
let isPronunciationHidden;
|
|
132
132
|
let isBotsHidden;
|
|
@@ -281,26 +281,12 @@ export const calcTopicCompletions = (topic, completions = [], isSectionHidden, a
|
|
|
281
281
|
completedExerciseCount++;
|
|
282
282
|
}
|
|
283
283
|
totalExercises++;
|
|
284
|
-
console.log({
|
|
285
|
-
bot,
|
|
286
|
-
includeChallengeBots,
|
|
287
|
-
completedCount,
|
|
288
|
-
completions
|
|
289
|
-
});
|
|
290
284
|
return {
|
|
291
285
|
...bot,
|
|
292
286
|
completedCount
|
|
293
287
|
};
|
|
294
288
|
});
|
|
295
289
|
const scoreValues = getScoreValues("topic", topic.topicId, completions);
|
|
296
|
-
console.log({
|
|
297
|
-
totalExercises,
|
|
298
|
-
completedExerciseCount,
|
|
299
|
-
topic,
|
|
300
|
-
roleplays,
|
|
301
|
-
bots,
|
|
302
|
-
scoreValues
|
|
303
|
-
});
|
|
304
290
|
return {
|
|
305
291
|
...topic,
|
|
306
292
|
roleplays,
|
|
@@ -330,6 +316,10 @@ export const calcTopicCompletions = (topic, completions = [], isSectionHidden, a
|
|
|
330
316
|
},
|
|
331
317
|
bots: {
|
|
332
318
|
completed: completedBots,
|
|
319
|
+
completedCounts: bots.map(bot => ({
|
|
320
|
+
botId: bot.botId,
|
|
321
|
+
completedCount: bot.completedCount
|
|
322
|
+
})),
|
|
333
323
|
total: bots.length,
|
|
334
324
|
percentage: Math.floor(completedBots / bots.length * 100)
|
|
335
325
|
}
|
|
@@ -340,21 +330,12 @@ export const calcTopicCompletions = (topic, completions = [], isSectionHidden, a
|
|
|
340
330
|
}
|
|
341
331
|
};
|
|
342
332
|
};
|
|
343
|
-
export const calcCompletions = (sections = [], completions = [], assignmentExercises
|
|
344
|
-
const {
|
|
345
|
-
includeChallengeBots = false
|
|
346
|
-
} = opts;
|
|
333
|
+
export const calcCompletions = (sections = [], completions = [], assignmentExercises, includeChallengeBots = false) => sections.map(section => {
|
|
347
334
|
const topics = section.topics.map(topic => {
|
|
348
335
|
return calcTopicCompletions(topic, completions, section.isHidden, assignmentExercises?.filter(e => e.courseSectionTopicId === `${topic.courseSectionId}|${topic.topicId}`), includeChallengeBots);
|
|
349
336
|
});
|
|
350
337
|
const sectionExerciseCount = topics.reduce((currentValue, topic) => topic.completion.total + currentValue, 0);
|
|
351
338
|
const sectionCompletedExerciseCount = topics.reduce((currentValue, topic) => topic.completion.completed + currentValue, 0);
|
|
352
|
-
console.log({
|
|
353
|
-
section,
|
|
354
|
-
sectionExerciseCount,
|
|
355
|
-
sectionCompletedExerciseCount,
|
|
356
|
-
topics
|
|
357
|
-
});
|
|
358
339
|
if (section.isHidden) {
|
|
359
340
|
return {
|
|
360
341
|
...section,
|
|
@@ -375,10 +356,6 @@ export const calcCompletions = (sections = [], completions = [], assignmentExerc
|
|
|
375
356
|
};
|
|
376
357
|
}
|
|
377
358
|
const scoreValues = getScoreValues("section", section.sectionId, completions);
|
|
378
|
-
console.log({
|
|
379
|
-
scoreValues,
|
|
380
|
-
section
|
|
381
|
-
});
|
|
382
359
|
return {
|
|
383
360
|
...section,
|
|
384
361
|
completion: {
|