Show correct numbers for subset of users on AssignmentSubmissionProgress

This commit is contained in:
Daniel Egger 2024-07-23 18:42:14 +02:00
parent 4f6b14efae
commit 661f5aa435
7 changed files with 21 additions and 11 deletions

View File

@ -32,7 +32,8 @@ 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,
@ -40,6 +41,10 @@ onMounted(async () => {
props.userSelectionIds
);
if (props.userSelectionIds && props.userSelectionIds.length > 0) {
total = props.userSelectionIds.length;
}
state.submissionProgressStatusCount = {
SUCCESS: assignmentSubmittedUsers.length,
UNKNOWN: total - assignmentSubmittedUsers.length,
@ -57,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;
};

View File

@ -5,7 +5,6 @@ import * as log from "loglevel";
import { computed } from "vue";
import type { LearningContentAssignment, LearningContentEdoniqTest } from "@/types";
import { useExpertCockpitPageData } from "@/pages/cockpit/cockpitPage/composables";
import { getPreviousRoute } from "@/router/history";
const props = defineProps<{
courseSlug: string;

View File

@ -24,9 +24,11 @@ const courseId = ref<string | undefined>(undefined);
const agentAssignmentData = ref<BaseStatisticsType | null>(null);
const courseSessionName = (courseSessionId: string) => {
return agentAssignmentData.value?.course_session_properties?.sessions.find(
(session) => session.id === courseSessionId
)?.name;
return (
agentAssignmentData.value?.course_session_properties?.sessions.find(
(session) => session.id === courseSessionId
)?.name ?? ""
);
};
const circleMeta = (circleId: string) => {
@ -71,7 +73,7 @@ onMounted(async () => {
v-if="agentAssignmentData"
:course-statistics="agentAssignmentData"
:course-session-name="courseSessionName"
:circle-meta="circleMeta"
:circle-meta="circleMeta as any"
:detail-base-url="`/statistic/${props.agentRole}/${props.courseSlug}/assignment/`"
></AssignmentList>
</div>

View File

@ -59,7 +59,6 @@ const itemDetailUrl = (item: AssignmentStatisticsRecordType) => {
}
return item.details_url;
};
</script>
<template>

View File

@ -1,5 +1,5 @@
import { useCourseSessionDetailQuery } from "@/composables";
import { itGet, itPost } from "@/fetchHelpers";
import { itPost } from "@/fetchHelpers";
import type {
Assignment,
AssignmentCompletion,

View File

@ -8,7 +8,6 @@ import {
import { itGetCached, itPost } from "@/fetchHelpers";
import type {
AssignmentsStatisticsType,
BaseStatisticsType,
CourseProgressType,
CourseStatisticsType,
@ -111,6 +110,7 @@ export const fetchStatisticData = async (
console.error("Error fetching statistics for course ID:", courseId, res.error);
}
// @ts-ignore
return res.data?.course_statistics || null;
} catch (error) {
console.error(`Error fetching statistics for course ID: ${courseId}`, error);

View File

@ -395,7 +395,7 @@ def get_widgets_for_course(
if "BERUFSBILDNER" in relation_roles:
if is_uk:
widgets.append(WidgetType.UK_STATISTICS_WIDGET.value)
widgets.append(WidgetType.UK_BERUFSBILDNER_STATISTICS_WIDGET.value)
return widgets
@ -532,7 +532,9 @@ def get_mentor_open_tasks_count(request, course_id: str):
return Response(
status=200,
data={
"open_task_count": _get_mentor_open_tasks_count(course_id, request.user) # noqa
"open_task_count": _get_mentor_open_tasks_count(
course_id, request.user
) # noqa
},
)
except PermissionDenied as e: