mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender-pwa.git
synced 2025-08-07 04:09:17 +02:00
feat:#40 added semester selection by month
This commit is contained in:
@@ -26,6 +26,19 @@ async function getCourses() {
|
|||||||
return { name: course };
|
return { name: course };
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// replace selected course if it is not available in the new courses list
|
||||||
|
if (
|
||||||
|
selectedCourse.value.name !== "" &&
|
||||||
|
!courses.value.some((course) => course.name === selectedCourse.value.name)
|
||||||
|
) {
|
||||||
|
selectedCourse.value = { name: "" };
|
||||||
|
}
|
||||||
|
// if course is selected, get the modules for the selected course
|
||||||
|
if (selectedCourse.value.name !== "") {
|
||||||
|
await getModules();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const store = moduleStore();
|
const store = moduleStore();
|
||||||
@@ -42,10 +55,14 @@ const semesters: ComputedRef<{ name: string; value: string }[]> = computed(
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// return current semester summer form march to august and winter from september to february
|
||||||
|
const currentSemester: { name: string; value: string } = new Date().getMonth() >= 2 && new Date().getMonth() <= 7 ? semesters.value[1] : semesters.value[0];
|
||||||
|
|
||||||
const selectedSemester: Ref<{ name: string; value: string }> = ref(
|
const selectedSemester: Ref<{ name: string; value: string }> = ref(
|
||||||
semesters.value[0],
|
currentSemester
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//if semesters get changed, refresh the selected semester ref with a watcher
|
//if semesters get changed, refresh the selected semester ref with a watcher
|
||||||
watch(
|
watch(
|
||||||
semesters,
|
semesters,
|
||||||
|
Reference in New Issue
Block a user