diff --git a/client/src/components/assignment/AssignmentSubmissionProgress.vue b/client/src/components/assignment/AssignmentSubmissionProgress.vue index 4dc55dec..06e8c72e 100644 --- a/client/src/components/assignment/AssignmentSubmissionProgress.vue +++ b/client/src/components/assignment/AssignmentSubmissionProgress.vue @@ -16,6 +16,7 @@ const props = defineProps<{ courseSession: CourseSession; learningContent: LearningContentAssignment | LearningContentEdoniqTest; showTitle: boolean; + userSelectionIds?: string[]; }>(); log.debug("AssignmentSubmissionProgress created", stringifyParse(props)); @@ -31,13 +32,19 @@ const state = reactive({ }); onMounted(async () => { - const { assignmentSubmittedUsers, gradedUsers, total } = + // eslint-disable-next-line prefer-const + let { assignmentSubmittedUsers, gradedUsers, total } = await loadAssignmentCompletionStatusData( props.learningContent.content_assignment.id, props.courseSession.id, - props.learningContent.id + props.learningContent.id, + props.userSelectionIds ); + if (props.userSelectionIds && props.userSelectionIds.length > 0) { + total = props.userSelectionIds.length; + } + state.submissionProgressStatusCount = { SUCCESS: assignmentSubmittedUsers.length, UNKNOWN: total - assignmentSubmittedUsers.length, @@ -55,6 +62,9 @@ const doneCount = (status: StatusCount) => { }; const totalCount = (status: StatusCount) => { + if (props.userSelectionIds && props.userSelectionIds.length > 0) { + return props.userSelectionIds.length; + } return doneCount(status) + status.UNKNOWN || 0; }; diff --git a/client/src/components/dashboard/MentorMenteeCount.vue b/client/src/components/dashboard/AgentConnectionCount.vue similarity index 60% rename from client/src/components/dashboard/MentorMenteeCount.vue rename to client/src/components/dashboard/AgentConnectionCount.vue index 10dc86f7..71f047f8 100644 --- a/client/src/components/dashboard/MentorMenteeCount.vue +++ b/client/src/components/dashboard/AgentConnectionCount.vue @@ -4,16 +4,27 @@ import { onMounted, ref } from "vue"; import { fetchMenteeCount } from "@/services/dashboard"; import BaseBox from "@/components/dashboard/BaseBox.vue"; -const props = defineProps<{ - courseId: string; - courseSlug: string; -}>(); +const props = withDefaults( + defineProps<{ + courseId: string; + courseSlug: string; + slim?: boolean; + count?: number; + }>(), + { + count: -1, + slim: false, + } +); -const menteeCount: Ref = ref(0); +const menteeCount: Ref = ref(props.count); onMounted(async () => { - const data = await fetchMenteeCount(props.courseId); - menteeCount.value = data?.mentee_count; + if (props.count == -1) { + menteeCount.value = 0; + const data = await fetchMenteeCount(props.courseId); + menteeCount.value = data?.mentee_count; + } }); @@ -21,11 +32,12 @@ onMounted(async () => {