WIP: Add supervisor base dashboard
This commit is contained in:
parent
77c69f1229
commit
121f7c227a
|
|
@ -8,6 +8,7 @@ import MentorOpenTasksCount from "@/components/dashboard/MentorOpenTasksCount.vu
|
|||
import MentorMenteeCount from "@/components/dashboard/MentorMenteeCount.vue";
|
||||
import MentorCompetenceSummary from "@/components/dashboard/MentorCompetenceSummary.vue";
|
||||
import { getLearningPathUrl } from "@/utils/utils";
|
||||
import UkStatistics from "@/components/dashboard/UkStatistics.vue";
|
||||
|
||||
const mentorWidgets = [
|
||||
"MentorTasksWidget",
|
||||
|
|
@ -135,6 +136,12 @@ function hasActionButton(): boolean {
|
|||
:course-id="courseConfig.course_id"
|
||||
></CompetenceSummary>
|
||||
</div>
|
||||
<div
|
||||
v-if="hasWidget('UKStatisticsWidget')"
|
||||
class="flex flex-col flex-wrap gap-x-[60px] border-b border-gray-300 pb-8 last:border-0 md:flex-row"
|
||||
>
|
||||
<UkStatistics :course-id="courseConfig.course_id" />
|
||||
</div>
|
||||
<div v-if="numberOfMentorWidgets > 0" class="flex flex-col flex-wrap md:flex-row">
|
||||
<MentorOpenTasksCount
|
||||
v-if="hasWidget('MentorTasksWidget')"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,64 @@
|
|||
<script setup lang="ts">
|
||||
import { useDashboardStore } from "@/stores/dashboard";
|
||||
import { computed } from "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 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="space-y-8">
|
||||
<div
|
||||
class="flex flex-col flex-wrap justify-between gap-x-5 border-b border-gray-300 pb-8 last:border-0 md:flex-row"
|
||||
>
|
||||
<AttendanceSummaryBox
|
||||
class="flex-grow"
|
||||
:days-completed="attendanceDayPresences.days_completed"
|
||||
:avg-participants-present="attendanceDayPresences.participants_present"
|
||||
/>
|
||||
<AssignmentSummaryBox
|
||||
class="flex-grow"
|
||||
:assignments-completed="assigmentSummary.completed_count"
|
||||
:avg-passed="assigmentSummary.average_passed"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="flex flex-col flex-wrap gap-x-5 border-b border-gray-300 pb-8 align-top last:border-0 md:flex-row"
|
||||
>
|
||||
<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>
|
||||
|
|
@ -34,7 +34,8 @@ export type WidgetType =
|
|||
| "MentorTasksWidget"
|
||||
| "MentorPersonWidget"
|
||||
| "MentorCompetenceWidget"
|
||||
| "CompetenceCertificateWidget";
|
||||
| "CompetenceCertificateWidget"
|
||||
| "UKStatisticsWidget";
|
||||
|
||||
export type DashboardPersonCourseSessionType = {
|
||||
id: number;
|
||||
|
|
|
|||
|
|
@ -233,6 +233,9 @@ class GetDashboardConfig(TestCase):
|
|||
],
|
||||
)
|
||||
|
||||
# test supervisor
|
||||
# test expert
|
||||
|
||||
|
||||
class GetMenteeCountTestCase(TestCase):
|
||||
def setUp(self):
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ class WidgetType(Enum):
|
|||
MENTOR_PERSON_WIDGET = "MentorPersonWidget"
|
||||
MENTOR_COMPETENCE_WIDGET = "MentorCompetenceWidget"
|
||||
COMPETENCE_CERTIFICATE_WIDGET = "CompetenceCertificateWidget"
|
||||
UK_STATISTICS_WIDGET = "UKStatisticsWidget"
|
||||
|
||||
|
||||
class RoleKeyType(Enum):
|
||||
|
|
@ -241,6 +242,9 @@ def get_widgets_for_course(
|
|||
if is_uk:
|
||||
widgets.append(WidgetType.COMPETENCE_CERTIFICATE_WIDGET.value)
|
||||
|
||||
if role_key == RoleKeyType.SUPERVISOR:
|
||||
widgets.append(WidgetType.UK_STATISTICS_WIDGET.value)
|
||||
|
||||
if is_mentor:
|
||||
widgets.append(WidgetType.MENTOR_PERSON_WIDGET.value)
|
||||
if is_vv:
|
||||
|
|
@ -379,8 +383,10 @@ 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:
|
||||
raise e
|
||||
|
|
|
|||
Loading…
Reference in New Issue