Make typechecker happy
This commit is contained in:
parent
d8316b177d
commit
34512f8db0
|
|
@ -17,24 +17,46 @@ const statistics = ref<CourseStatisticsType | null>(null);
|
||||||
const dashboardStore = useDashboardStore();
|
const dashboardStore = useDashboardStore();
|
||||||
|
|
||||||
const attendanceDayPresences = computed(() => {
|
const attendanceDayPresences = computed(() => {
|
||||||
return statistics.value.attendance_day_presences.summary;
|
return (
|
||||||
|
statistics?.value?.attendance_day_presences?.summary ?? {
|
||||||
|
days_completed: 0,
|
||||||
|
participants_present: 0,
|
||||||
|
}
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
const assigmentSummary = computed(() => {
|
const assigmentSummary = computed(() => {
|
||||||
return statistics.value.assignments.summary;
|
return (
|
||||||
|
statistics?.value?.assignments.summary ?? {
|
||||||
|
average_passed: 0,
|
||||||
|
completed_count: 0,
|
||||||
|
total_passed: 0,
|
||||||
|
total_failed: 0,
|
||||||
|
}
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
const competenceSummary = computed(() => {
|
const competenceSummary = computed(() => {
|
||||||
return statistics.value.competences.summary;
|
return (
|
||||||
|
statistics?.value?.competences.summary ?? {
|
||||||
|
fail_total: 0,
|
||||||
|
success_total: 0,
|
||||||
|
}
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
const feebackSummary = computed(() => {
|
const feebackSummary = computed(() => {
|
||||||
return statistics.value.feedback_responses.summary;
|
return (
|
||||||
|
statistics?.value?.feedback_responses.summary ?? {
|
||||||
|
satisfaction_average: 0,
|
||||||
|
satisfaction_max: 0,
|
||||||
|
total_responses: 0,
|
||||||
|
}
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
statistics.value = await dashboardStore.loadStatisticsDatav2(props.courseId);
|
statistics.value = await dashboardStore.loadStatisticsDatav2(props.courseId);
|
||||||
//await dashboardStore.loadStatisticsData(props.courseId);
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -616,7 +616,7 @@ export function useCourseCircleProgress(circles: Ref<CircleType[] | undefined>)
|
||||||
|
|
||||||
export function useCourseStatisticsv2(courseSlug: string) {
|
export function useCourseStatisticsv2(courseSlug: string) {
|
||||||
const dashboardStore = useDashboardStore();
|
const dashboardStore = useDashboardStore();
|
||||||
const courseStatistics = ref<CourseStatisticsType[] | null>(null);
|
const courseStatistics = ref<CourseStatisticsType | null>(null);
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
|
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
|
|
@ -627,20 +627,22 @@ export function useCourseStatisticsv2(courseSlug: string) {
|
||||||
courseSlug
|
courseSlug
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
courseStatistics.value = await fetchStatisticData(courseId);
|
if (courseId) {
|
||||||
|
courseStatistics.value = await fetchStatisticData(courseId);
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const courseSessionName = (courseSessionId: string) => {
|
const courseSessionName = (courseSessionId: string) => {
|
||||||
return courseStatistics.value.course_session_properties.sessions.find(
|
return courseStatistics?.value?.course_session_properties?.sessions.find(
|
||||||
(session) => session.id === courseSessionId
|
(session) => session.id === courseSessionId
|
||||||
)?.name;
|
)?.name;
|
||||||
};
|
};
|
||||||
|
|
||||||
const circleMeta = (circleId: string) => {
|
const circleMeta = (circleId: string) => {
|
||||||
return courseStatistics.value.course_session_properties.circles.find(
|
return courseStatistics?.value?.course_session_properties.circles.find(
|
||||||
(circle) => circle.id === circleId
|
(circle) => circle.id === circleId
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,66 +0,0 @@
|
||||||
<script setup lang="ts">
|
|
||||||
import { useDashboardStore } from "@/stores/dashboard";
|
|
||||||
import { computed } from "vue";
|
|
||||||
import CourseStatistics from "@/components/dashboard/CourseStatistics.vue";
|
|
||||||
import AttendanceSummaryBox from "@/components/dashboard/AttendanceSummaryBox.vue";
|
|
||||||
import type { CourseStatisticsType } from "@/gql/graphql";
|
|
||||||
import AssignmentSummaryBox from "@/components/dashboard/AssignmentSummaryBox.vue";
|
|
||||||
import FeedbackSummaryBox from "@/components/dashboard/FeedbackSummaryBox.vue";
|
|
||||||
import CompetenceSummaryBox from "@/components/dashboard/CompetenceSummaryBox.vue";
|
|
||||||
|
|
||||||
const dashboardStore = useDashboardStore();
|
|
||||||
|
|
||||||
const statistics = computed(() => {
|
|
||||||
return dashboardStore.currentDashBoardData as CourseStatisticsType;
|
|
||||||
});
|
|
||||||
|
|
||||||
const courseSessionSelectionMetrics = computed(() => {
|
|
||||||
return statistics.value.course_session_selection_metrics;
|
|
||||||
});
|
|
||||||
|
|
||||||
const attendanceDayPresences = computed(() => {
|
|
||||||
return statistics.value.attendance_day_presences.summary;
|
|
||||||
});
|
|
||||||
|
|
||||||
const assigmentSummary = computed(() => {
|
|
||||||
return statistics.value.assignments.summary;
|
|
||||||
});
|
|
||||||
|
|
||||||
const competenceSummary = computed(() => {
|
|
||||||
return statistics.value.competences.summary;
|
|
||||||
});
|
|
||||||
|
|
||||||
const feebackSummary = computed(() => {
|
|
||||||
return statistics.value.feedback_responses.summary;
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div v-if="statistics" class="mb-14 space-y-8">
|
|
||||||
<CourseStatistics
|
|
||||||
:session-count="courseSessionSelectionMetrics.session_count"
|
|
||||||
:participant-count="courseSessionSelectionMetrics.participant_count"
|
|
||||||
:expert-count="courseSessionSelectionMetrics.expert_count"
|
|
||||||
/>
|
|
||||||
<div class="grid auto-rows-fr grid-cols-1 gap-8 xl:grid-cols-2">
|
|
||||||
<AttendanceSummaryBox
|
|
||||||
:days-completed="attendanceDayPresences.days_completed"
|
|
||||||
:avg-participants-present="attendanceDayPresences.participants_present"
|
|
||||||
/>
|
|
||||||
<AssignmentSummaryBox
|
|
||||||
:assignments-completed="assigmentSummary.completed_count"
|
|
||||||
:avg-passed="assigmentSummary.average_passed"
|
|
||||||
/>
|
|
||||||
<FeedbackSummaryBox
|
|
||||||
:feedback-count="feebackSummary.total_responses"
|
|
||||||
:statisfaction-max="feebackSummary.satisfaction_max"
|
|
||||||
:statisfaction-avg="feebackSummary.satisfaction_average"
|
|
||||||
/>
|
|
||||||
<CompetenceSummaryBox
|
|
||||||
:fail-count="competenceSummary.fail_total"
|
|
||||||
:success-count="competenceSummary.success_total"
|
|
||||||
details-link="/statistic/competence"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
Loading…
Reference in New Issue