WIP: Fix statistic pages
This commit is contained in:
parent
b58bceb14d
commit
49bd67f3e0
|
|
@ -587,10 +587,24 @@ export function useCourseStatisticsv2(courseId: string) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const courseSessionName = (courseSessionId: string) => {
|
||||||
|
return courseStatistics.value.course_session_properties.sessions.find(
|
||||||
|
(session) => session.id === courseSessionId
|
||||||
|
)?.name;
|
||||||
|
};
|
||||||
|
|
||||||
|
const circleMeta = (circleId: string) => {
|
||||||
|
return courseStatistics.value.course_session_properties.circles.find(
|
||||||
|
(circle) => circle.id === circleId
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
onMounted(fetchData);
|
onMounted(fetchData);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
courseStatistics,
|
courseStatistics,
|
||||||
loading,
|
loading,
|
||||||
|
courseSessionName,
|
||||||
|
circleMeta,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,11 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useDashboardStore } from "@/stores/dashboard";
|
import { useDashboardStore } from "@/stores/dashboard";
|
||||||
import { onMounted, ref } from "vue";
|
|
||||||
import type {
|
import type {
|
||||||
AssignmentCompletionMetricsType,
|
AssignmentCompletionMetricsType,
|
||||||
AssignmentStatisticsRecordType,
|
AssignmentStatisticsRecordType,
|
||||||
CourseStatisticsType,
|
|
||||||
} from "@/gql/graphql";
|
} from "@/gql/graphql";
|
||||||
import StatisticFilterList from "@/components/dashboard/StatisticFilterList.vue";
|
import StatisticFilterList from "@/components/dashboard/StatisticFilterList.vue";
|
||||||
import { useCourseStatistics, useCourseStatisticsv2 } from "@/composables";
|
import { useCourseStatisticsv2 } from "@/composables";
|
||||||
import { getDateString } from "@/components/dueDates/dueDatesUtils";
|
import { getDateString } from "@/components/dueDates/dueDatesUtils";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { courseIdForCourseSlug } from "@/services/dashboard";
|
import { courseIdForCourseSlug } from "@/services/dashboard";
|
||||||
|
|
@ -19,23 +17,12 @@ const props = defineProps<{
|
||||||
|
|
||||||
const dashboardStore = useDashboardStore();
|
const dashboardStore = useDashboardStore();
|
||||||
|
|
||||||
const statistics = ref<CourseStatisticsType | null>(null);
|
|
||||||
// const statistics = reactive<CourseStatisticsType>({
|
|
||||||
// course_session_properties: {
|
|
||||||
// sessions: [],
|
|
||||||
// generations: [],
|
|
||||||
// circles: [],
|
|
||||||
// },
|
|
||||||
// assignments: { records: [] },
|
|
||||||
// });
|
|
||||||
|
|
||||||
const courseId = courseIdForCourseSlug(
|
const courseId = courseIdForCourseSlug(
|
||||||
dashboardStore.dashboardConfigsv2,
|
dashboardStore.dashboardConfigsv2,
|
||||||
props.courseSlug
|
props.courseSlug
|
||||||
);
|
);
|
||||||
const { courseStatistics, loading } = useCourseStatisticsv2(courseId);
|
const { courseStatistics, loading, courseSessionName, circleMeta } =
|
||||||
|
useCourseStatisticsv2(courseId);
|
||||||
const { courseSessionName, circleMeta } = useCourseStatistics();
|
|
||||||
|
|
||||||
const assignmentStats = (metrics: AssignmentCompletionMetricsType) => {
|
const assignmentStats = (metrics: AssignmentCompletionMetricsType) => {
|
||||||
if (!metrics.ranking_completed) {
|
if (!metrics.ranking_completed) {
|
||||||
|
|
@ -56,33 +43,16 @@ const assignmentStats = (metrics: AssignmentCompletionMetricsType) => {
|
||||||
const total = (metrics: AssignmentCompletionMetricsType) => {
|
const total = (metrics: AssignmentCompletionMetricsType) => {
|
||||||
return metrics.passed_count + metrics.failed_count + metrics.unranked_count;
|
return metrics.passed_count + metrics.failed_count + metrics.unranked_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(async () => {
|
|
||||||
console.log("onMount AssignmentList", courseId, props.courseSlug, statistics);
|
|
||||||
if (!courseId) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// statistics.value = await dashboardStore.loadStatisticsDatav2(courseId);
|
|
||||||
// const some = await courseStatistics.loadStatisticsDatav2(courseId);
|
|
||||||
// console.log("some", some.course_session_properties);
|
|
||||||
// statistics.value = some;
|
|
||||||
// console.log("other", statistics.value.course_session_properties);
|
|
||||||
// statistics.course_session_properties = some.course_session_properties;
|
|
||||||
// statistics.assignments = some.assignments;
|
|
||||||
// statistics.console.log(statistics.value);
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
{{ loading }}
|
|
||||||
<main v-if="!loading">
|
<main v-if="!loading">
|
||||||
<div class="mb-10 flex items-center justify-between">
|
<div class="mb-10 flex items-center justify-between">
|
||||||
<h3>{{ $t("a.Kompetenznachweis-Elemente") }}</h3>
|
<h3>{{ $t("a.Kompetenznachweis-Elemente") }}</h3>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="courseStatistics?.assignments.records" class="mt-8 bg-white">
|
<div v-if="courseStatistics?.assignments.records" class="mt-8 bg-white">
|
||||||
<StatisticFilterList
|
<StatisticFilterList
|
||||||
v-if="courseStatistics?.course_session_properties"
|
:course-session-properties="courseStatistics?.course_session_properties"
|
||||||
:course-session-properties="courseStatistics.course_session_properties"
|
|
||||||
:items="courseStatistics.assignments.records"
|
:items="courseStatistics.assignments.records"
|
||||||
>
|
>
|
||||||
<template #default="{ item }">
|
<template #default="{ item }">
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useDashboardStore } from "@/stores/dashboard";
|
import { useDashboardStore } from "@/stores/dashboard";
|
||||||
import { onMounted, ref } from "vue";
|
import type { PresenceRecordStatisticsType } from "@/gql/graphql";
|
||||||
import type { CourseStatisticsType, PresenceRecordStatisticsType } from "@/gql/graphql";
|
|
||||||
import StatisticFilterList from "@/components/dashboard/StatisticFilterList.vue";
|
import StatisticFilterList from "@/components/dashboard/StatisticFilterList.vue";
|
||||||
import ItProgress from "@/components/ui/ItProgress.vue";
|
import ItProgress from "@/components/ui/ItProgress.vue";
|
||||||
import { useCourseStatistics } from "@/composables";
|
import { useCourseStatisticsv2 } from "@/composables";
|
||||||
import { getDateString } from "@/components/dueDates/dueDatesUtils";
|
import { getDateString } from "@/components/dueDates/dueDatesUtils";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { courseIdForCourseSlug } from "@/services/dashboard";
|
import { courseIdForCourseSlug } from "@/services/dashboard";
|
||||||
|
|
@ -15,14 +14,12 @@ const props = defineProps<{
|
||||||
|
|
||||||
const dashboardStore = useDashboardStore();
|
const dashboardStore = useDashboardStore();
|
||||||
|
|
||||||
const statistics = ref<CourseStatisticsType | null>(null);
|
|
||||||
|
|
||||||
const courseId = courseIdForCourseSlug(
|
const courseId = courseIdForCourseSlug(
|
||||||
dashboardStore.dashboardConfigsv2,
|
dashboardStore.dashboardConfigsv2,
|
||||||
props.courseSlug
|
props.courseSlug
|
||||||
);
|
);
|
||||||
|
const { courseStatistics, loading, courseSessionName, circleMeta } =
|
||||||
const { courseSessionName, circleMeta } = useCourseStatistics();
|
useCourseStatisticsv2(courseId);
|
||||||
|
|
||||||
const attendanceStats = (present: number, total: number) => {
|
const attendanceStats = (present: number, total: number) => {
|
||||||
return {
|
return {
|
||||||
|
|
@ -31,22 +28,20 @@ const attendanceStats = (present: number, total: number) => {
|
||||||
UNKNOWN: 0,
|
UNKNOWN: 0,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(async () => {
|
|
||||||
console.log("onMount AttendanceList", courseId, props.courseSlug, statistics);
|
|
||||||
statistics.value = await dashboardStore.loadStatisticsDatav2(courseId);
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<main v-if="statistics">
|
<main v-if="!loading">
|
||||||
<div class="mb-10 flex items-center justify-between">
|
<div class="mb-10 flex items-center justify-between">
|
||||||
<h3>{{ $t("Anwesenheit") }}</h3>
|
<h3>{{ $t("Anwesenheit") }}</h3>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="statistics.attendance_day_presences.records" class="mt-8 bg-white">
|
<div
|
||||||
|
v-if="courseStatistics?.attendance_day_presences.records"
|
||||||
|
class="mt-8 bg-white"
|
||||||
|
>
|
||||||
<StatisticFilterList
|
<StatisticFilterList
|
||||||
:course-session-properties="statistics.course_session_properties"
|
:course-session-properties="courseStatistics.course_session_properties"
|
||||||
:items="statistics.attendance_day_presences.records"
|
:items="courseStatistics.attendance_day_presences.records"
|
||||||
>
|
>
|
||||||
<template #default="{ item }">
|
<template #default="{ item }">
|
||||||
<div class="flex justify-between">
|
<div class="flex justify-between">
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,9 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useDashboardStore } from "@/stores/dashboard";
|
import { useDashboardStore } from "@/stores/dashboard";
|
||||||
import ItDropdownSelect from "@/components/ui/ItDropdownSelect.vue";
|
import ItDropdownSelect from "@/components/ui/ItDropdownSelect.vue";
|
||||||
import { onMounted, ref } from "vue";
|
|
||||||
import type { CompetenceRecordStatisticsType } from "@/gql/graphql";
|
import type { CompetenceRecordStatisticsType } from "@/gql/graphql";
|
||||||
import { CourseStatisticsType } from "@/gql/graphql";
|
|
||||||
import StatisticFilterList from "@/components/dashboard/StatisticFilterList.vue";
|
import StatisticFilterList from "@/components/dashboard/StatisticFilterList.vue";
|
||||||
import { useCourseStatistics } from "@/composables";
|
import { useCourseStatisticsv2 } from "@/composables";
|
||||||
import { courseIdForCourseSlug } from "@/services/dashboard";
|
import { courseIdForCourseSlug } from "@/services/dashboard";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
|
@ -13,22 +11,18 @@ const props = defineProps<{
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const dashboardStore = useDashboardStore();
|
const dashboardStore = useDashboardStore();
|
||||||
const statistics = ref<CourseStatisticsType | null>(null);
|
|
||||||
|
|
||||||
const courseId = courseIdForCourseSlug(
|
const courseId = courseIdForCourseSlug(
|
||||||
dashboardStore.dashboardConfigsv2,
|
dashboardStore.dashboardConfigsv2,
|
||||||
props.courseSlug
|
props.courseSlug
|
||||||
);
|
);
|
||||||
|
|
||||||
const { courseSessionName, circleMeta } = useCourseStatistics();
|
const { courseStatistics, loading, courseSessionName, circleMeta } =
|
||||||
|
useCourseStatisticsv2(courseId);
|
||||||
onMounted(async () => {
|
|
||||||
statistics.value = await dashboardStore.loadStatisticsDatav2(courseId);
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<main v-if="statistics">
|
<main v-if="courseStatistics">
|
||||||
<div class="mb-10 flex items-center justify-between">
|
<div class="mb-10 flex items-center justify-between">
|
||||||
<h3>{{ $t("a.Selbsteinschätzung") }}</h3>
|
<h3>{{ $t("a.Selbsteinschätzung") }}</h3>
|
||||||
<ItDropdownSelect
|
<ItDropdownSelect
|
||||||
|
|
@ -38,10 +32,10 @@ onMounted(async () => {
|
||||||
@update:model-value="dashboardStore.switchAndLoadDashboardConfig"
|
@update:model-value="dashboardStore.switchAndLoadDashboardConfig"
|
||||||
></ItDropdownSelect>
|
></ItDropdownSelect>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="statistics.competences.records" class="mt-8 bg-white">
|
<div v-if="courseStatistics?.competences.records" class="mt-8 bg-white">
|
||||||
<StatisticFilterList
|
<StatisticFilterList
|
||||||
:course-session-properties="statistics.course_session_properties"
|
:course-session-properties="courseStatistics.course_session_properties"
|
||||||
:items="statistics.competences.records"
|
:items="courseStatistics.competences.records"
|
||||||
>
|
>
|
||||||
<template #default="{ item }">
|
<template #default="{ item }">
|
||||||
<div class="flex justify-between">
|
<div class="flex justify-between">
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,11 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useDashboardStore } from "@/stores/dashboard";
|
import { useDashboardStore } from "@/stores/dashboard";
|
||||||
import { computed, onMounted, watch } from "vue";
|
import { onMounted } from "vue";
|
||||||
import LoadingSpinner from "@/components/ui/LoadingSpinner.vue";
|
import LoadingSpinner from "@/components/ui/LoadingSpinner.vue";
|
||||||
|
|
||||||
const dashboardStore = useDashboardStore();
|
const dashboardStore = useDashboardStore();
|
||||||
dashboardStore.loading = true;
|
dashboardStore.loading = true;
|
||||||
|
|
||||||
const some = computed(() => {
|
|
||||||
return dashboardStore.loading;
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(some, () => {
|
|
||||||
console.log("watch loading", dashboardStore.loading);
|
|
||||||
});
|
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
console.log("onMount StatisticParentPage", dashboardStore.loading);
|
console.log("onMount StatisticParentPage", dashboardStore.loading);
|
||||||
await dashboardStore.loadDashboardDetails();
|
await dashboardStore.loadDashboardDetails();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue