From 417b2c58b81ae3c5df997f5825661f7cef7b7ce2 Mon Sep 17 00:00:00 2001 From: Reto Aebersold Date: Thu, 21 Sep 2023 17:47:58 +0200 Subject: [PATCH 1/2] Move document upload to cockpit --- .../circle}/DocumentListItem.vue | 21 +- .../cockpit/cockpitPage/CockpitDates.vue | 4 +- .../pages/cockpit/cockpitPage/CockpitPage.vue | 275 ++++++++++-------- .../cockpit/documentPage/DocumentPage.vue | 132 +++++++++ .../documentPage}/DocumentUploadForm.vue | 0 .../circlePage/DocumentSection.vue | 96 +----- client/src/router/index.ts | 5 + client/src/stores/cockpit.ts | 50 ++-- 8 files changed, 338 insertions(+), 245 deletions(-) rename client/src/{pages/learningPath/circlePage => components/circle}/DocumentListItem.vue (79%) create mode 100644 client/src/pages/cockpit/documentPage/DocumentPage.vue rename client/src/pages/{learningPath/circlePage => cockpit/documentPage}/DocumentUploadForm.vue (100%) diff --git a/client/src/pages/learningPath/circlePage/DocumentListItem.vue b/client/src/components/circle/DocumentListItem.vue similarity index 79% rename from client/src/pages/learningPath/circlePage/DocumentListItem.vue rename to client/src/components/circle/DocumentListItem.vue index c9b4632f..b11f8327 100644 --- a/client/src/pages/learningPath/circlePage/DocumentListItem.vue +++ b/client/src/components/circle/DocumentListItem.vue @@ -20,14 +20,19 @@ diff --git a/client/src/pages/cockpit/cockpitPage/CockpitDates.vue b/client/src/pages/cockpit/cockpitPage/CockpitDates.vue index c3724c96..f1cea728 100644 --- a/client/src/pages/cockpit/cockpitPage/CockpitDates.vue +++ b/client/src/pages/cockpit/cockpitPage/CockpitDates.vue @@ -9,9 +9,9 @@ const courseSession = useCurrentCourseSession(); const circleDates = computed(() => { const dueDates = courseSession.value.due_dates.filter((dueDate) => { - if (!cockpitStore.selectedCircle) return false; + if (!cockpitStore.currentCircle) return false; return ( - cockpitStore.selectedCircle.translation_key == dueDate?.circle?.translation_key + cockpitStore.currentCircle.translation_key == dueDate?.circle?.translation_key ); }); return dueDates.slice(0, 4); diff --git a/client/src/pages/cockpit/cockpitPage/CockpitPage.vue b/client/src/pages/cockpit/cockpitPage/CockpitPage.vue index 1bc0ffac..99c0668b 100644 --- a/client/src/pages/cockpit/cockpitPage/CockpitPage.vue +++ b/client/src/pages/cockpit/cockpitPage/CockpitPage.vue @@ -10,6 +10,7 @@ import { useCompetenceStore } from "@/stores/competence"; import { useLearningPathStore } from "@/stores/learningPath"; import log from "loglevel"; import CockpitDates from "@/pages/cockpit/cockpitPage/CockpitDates.vue"; +import { useCourseSessionsStore } from "@/stores/courseSessions"; import ItDropdownSelect from "@/components/ui/ItDropdownSelect.vue"; const props = defineProps<{ @@ -22,12 +23,13 @@ const cockpitStore = useCockpitStore(); const competenceStore = useCompetenceStore(); const learningPathStore = useLearningPathStore(); const courseSession = useCurrentCourseSession(); +const courseSessionsStore = useCourseSessionsStore(); function userCountStatusForCircle(userId: string) { - if (!cockpitStore.selectedCircle) return { FAIL: 0, SUCCESS: 0, UNKNOWN: 0 }; + if (!cockpitStore.currentCircle) return { FAIL: 0, SUCCESS: 0, UNKNOWN: 0 }; const criteria = competenceStore.flatPerformanceCriteria( userId, - cockpitStore.selectedCircle.id + cockpitStore.currentCircle.id ); return competenceStore.calcStatusCount(criteria); } @@ -35,146 +37,173 @@ function userCountStatusForCircle(userId: string) { -
- -
- - - - - -
-

- {{ $t("circlePage.documents.trainerTitle") }} -

-
- {{ $t("circlePage.documents.trainerDescription") }} -
- - {{ $t("circlePage.documents.trainerLinkText") }} -
diff --git a/client/src/router/index.ts b/client/src/router/index.ts index dac7036f..28f710de 100644 --- a/client/src/router/index.ts +++ b/client/src/router/index.ts @@ -165,6 +165,11 @@ const router = createRouter({ import("@/pages/cockpit/attendanceCheckPage/AttendanceCheckPage.vue"), props: true, }, + { + path: "documents", + component: () => import("@/pages/cockpit/documentPage/DocumentPage.vue"), + props: true, + }, ], }, { diff --git a/client/src/stores/cockpit.ts b/client/src/stores/cockpit.ts index 096e7699..a1f72db0 100644 --- a/client/src/stores/cockpit.ts +++ b/client/src/stores/cockpit.ts @@ -2,26 +2,18 @@ import { itGetCached } from "@/fetchHelpers"; import type { CourseSessionUser, ExpertSessionUser } from "@/types"; import log from "loglevel"; +import { useCircleStore } from "@/stores/circle"; import { useLearningPathStore } from "@/stores/learningPath"; import { useUserStore } from "@/stores/user"; import { defineStore } from "pinia"; export type CockpitStoreState = { courseSessionMembers: CourseSessionUser[] | undefined; - selectedCircle: - | { - id: number; - name: string; - slug: string; - translation_key: string; - } - | undefined; circles: { - id: number; + id: string; name: string; - slug: string; - translation_key: string; }[]; + currentCourseSlug: string | undefined; }; export const useCockpitStore = defineStore({ @@ -29,29 +21,38 @@ export const useCockpitStore = defineStore({ state: () => { return { courseSessionMembers: undefined, - selectedCircle: undefined, circles: [], + currentCourseSlug: undefined, } as CockpitStoreState; }, actions: { async loadCircles(courseSlug: string, courseSessionId: number) { - log.debug("loadCircles called"); + log.debug("loadCircles called", courseSlug, courseSessionId); + this.currentCourseSlug = courseSlug; - const f = await courseCircles(courseSlug, courseSessionId); + const f = await courseCircles(this.currentCourseSlug, courseSessionId); this.circles = f.map((c) => { return { - id: c.id, + id: c.slug, name: c.title, - slug: c.slug, - translation_key: c.translation_key, }; }); if (this.circles.length > 0) { - this.selectedCircle = this.circles[0]; + await this.setCurrentCourseCircle(this.circles[0].id); } }, + async setCurrentCourseCircle(circleSlug: string) { + if (!this.currentCourseSlug) { + throw new Error("currentCourseSlug is undefined"); + } + const circleStore = useCircleStore(); + await circleStore.loadCircle(this.currentCourseSlug, circleSlug); + }, + async setCurrentCourseCircleFromEvent(event: { id: string }) { + await this.setCurrentCourseCircle(event.id); + }, async loadCourseSessionMembers(courseSessionId: number, reload = false) { log.debug("loadCourseSessionMembers called"); const users = (await itGetCached( @@ -65,6 +66,19 @@ export const useCockpitStore = defineStore({ return this.courseSessionMembers; }, }, + getters: { + currentCircle: () => { + const circleStore = useCircleStore(); + return circleStore.circle; + }, + selectedCircle: () => { + const circleStore = useCircleStore(); + return { + id: circleStore.circle?.id || 0, + name: circleStore.circle?.title || "", + }; + }, + }, }); async function courseCircles(courseSlug: string, courseSessionId: number) { From 218ef78e3a15142a16bc1c864c2f4b850c7526bb Mon Sep 17 00:00:00 2001 From: Christian Cueni Date: Wed, 4 Oct 2023 08:44:49 +0200 Subject: [PATCH 2/2] fix: update edoniq period duration --- server/vbv_lernwelt/importer/services.py | 5 ++++- .../importer/tests/test_import_course_sessions.py | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/server/vbv_lernwelt/importer/services.py b/server/vbv_lernwelt/importer/services.py index 935e6f1d..be64194a 100644 --- a/server/vbv_lernwelt/importer/services.py +++ b/server/vbv_lernwelt/importer/services.py @@ -202,6 +202,7 @@ TRANSLATIONS = { } T2L_IGNORE_FIELDS = ["Vorname", "Name", "Email", "Sprache", "Durchführungen"] +EDONIQ_TEST_PERIOD = 14 class DataImportError(Exception): @@ -487,7 +488,9 @@ def create_or_update_course_session_edoniq_test( # trigger save to update due date cset.save() - cset.deadline.start = timezone.make_aware(start) + timezone.timedelta(days=10) + cset.deadline.start = timezone.make_aware(start) + timezone.timedelta( + days=EDONIQ_TEST_PERIOD + ) cset.deadline.end = None cset.deadline.save() diff --git a/server/vbv_lernwelt/importer/tests/test_import_course_sessions.py b/server/vbv_lernwelt/importer/tests/test_import_course_sessions.py index 6112eaa0..9e276392 100644 --- a/server/vbv_lernwelt/importer/tests/test_import_course_sessions.py +++ b/server/vbv_lernwelt/importer/tests/test_import_course_sessions.py @@ -309,7 +309,7 @@ class CreateOrUpdateEdoniqTestCase(TestCase): self._create_or_update_edonqi_test("2023-06-06T11:30:00+00:00") test = CourseSessionEdoniqTest.objects.first() - self.assertEqual(test.deadline.start.isoformat(), "2023-06-16T11:30:00+00:00") + self.assertEqual(test.deadline.start.isoformat(), "2023-06-20T11:30:00+00:00") def test_update_course_session(self): self._create_or_update_edonqi_test("2023-06-06T11:30:00+00:00") @@ -318,4 +318,4 @@ class CreateOrUpdateEdoniqTestCase(TestCase): self.assertEqual(duedate_count, DueDate.objects.count()) test = CourseSessionEdoniqTest.objects.first() - self.assertEqual(test.deadline.start.isoformat(), "2023-07-16T11:30:00+00:00") + self.assertEqual(test.deadline.start.isoformat(), "2023-07-20T11:30:00+00:00")