Rename `courseSessionStore` to `courseSessionsStore`
This commit is contained in:
parent
0401298f85
commit
e2347d8571
|
|
@ -16,13 +16,13 @@ const props = defineProps<{
|
|||
const cockpitStore = useCockpitStore();
|
||||
const competenceStore = useCompetenceStore();
|
||||
const learningPathStore = useLearningPathStore();
|
||||
const courseSessionStore = useCourseSessionsStore();
|
||||
const courseSessionsStore = useCourseSessionsStore();
|
||||
|
||||
onMounted(async () => {
|
||||
log.debug("CockpitParentPage mounted", props.courseSlug);
|
||||
|
||||
try {
|
||||
const currentCourseSession = courseSessionStore.currentCourseSession;
|
||||
const currentCourseSession = courseSessionsStore.currentCourseSession;
|
||||
if (currentCourseSession?.id) {
|
||||
await cockpitStore.loadCourseSessionUsers(currentCourseSession.id);
|
||||
cockpitStore.courseSessionUsers?.forEach((csu) => {
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ const props = defineProps<{
|
|||
|
||||
log.debug("FeedbackPage created", props.circleId);
|
||||
|
||||
const courseSessionStore = useCourseSessionsStore();
|
||||
const courseSessionsStore = useCourseSessionsStore();
|
||||
const { t } = useI18n();
|
||||
|
||||
const orderedQuestions = [
|
||||
|
|
@ -149,7 +149,7 @@ const feedbackData = reactive<FeedbackData>({ amount: 0, questions: {} });
|
|||
onMounted(async () => {
|
||||
log.debug("FeedbackPage mounted");
|
||||
const data = await itGet(
|
||||
`/api/core/feedback/${courseSessionStore.currentCourseSession?.course.id}/${props.circleId}`
|
||||
`/api/core/feedback/${courseSessionsStore.currentCourseSession?.course.id}/${props.circleId}`
|
||||
);
|
||||
Object.assign(feedbackData, data);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -34,14 +34,14 @@ const state: StateInterface = reactive({
|
|||
});
|
||||
|
||||
const assignmentStore = useAssignmentStore();
|
||||
const courseSessionStore = useCourseSessionsStore();
|
||||
const courseSessionsStore = useCourseSessionsStore();
|
||||
const router = useRouter();
|
||||
|
||||
onMounted(async () => {
|
||||
log.debug("AssignmentView mounted", props.assignmentId, props.userId);
|
||||
|
||||
if (courseSessionStore.currentCourseSession) {
|
||||
state.assignmentUser = courseSessionStore.currentCourseSession.users.find(
|
||||
if (courseSessionsStore.currentCourseSession) {
|
||||
state.assignmentUser = courseSessionsStore.currentCourseSession.users.find(
|
||||
(user) => user.user_id === Number(props.userId)
|
||||
);
|
||||
}
|
||||
|
|
@ -50,7 +50,7 @@ onMounted(async () => {
|
|||
state.assignment = await assignmentStore.loadAssignment(props.assignmentId);
|
||||
await assignmentStore.loadAssignmentCompletion(
|
||||
props.assignmentId,
|
||||
courseSessionStore.currentCourseSession!.id,
|
||||
courseSessionsStore.currentCourseSession!.id,
|
||||
props.userId
|
||||
);
|
||||
} catch (error) {
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@
|
|||
import EvaluationIntro from "@/pages/cockpit/assignmentEvaluationPage/EvaluationIntro.vue";
|
||||
import EvaluationSummary from "@/pages/cockpit/assignmentEvaluationPage/EvaluationSummary.vue";
|
||||
import EvaluationTask from "@/pages/cockpit/assignmentEvaluationPage/EvaluationTask.vue";
|
||||
import { calcAssignmentLearningContents } from "@/services/assignmentService";
|
||||
import { useAssignmentStore } from "@/stores/assignmentStore";
|
||||
import { useCourseSessionsStore } from "@/stores/courseSessions";
|
||||
import { useLearningPathStore } from "@/stores/learningPath";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
import type {
|
||||
Assignment,
|
||||
AssignmentCompletion,
|
||||
|
|
@ -35,7 +31,6 @@ const state: StateInterface = reactive({
|
|||
pageIndex: 0,
|
||||
});
|
||||
|
||||
const courseSessionStore = useCourseSessionsStore();
|
||||
const assignmentStore = useAssignmentStore();
|
||||
|
||||
const numTasks = computed(() => props.assignment.evaluation_tasks?.length ?? 0);
|
||||
|
|
@ -70,30 +65,10 @@ function editTask(task: AssignmentEvaluationTask) {
|
|||
state.pageIndex = taskIndex + 1;
|
||||
}
|
||||
|
||||
function findAssignmentDetail() {
|
||||
const learningPathStore = useLearningPathStore();
|
||||
const userStore = useUserStore();
|
||||
// TODO: filter by selected circle
|
||||
if (!courseSessionStore.currentCourseSession) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const learningContents = calcAssignmentLearningContents(
|
||||
learningPathStore.learningPathForUser(
|
||||
courseSessionStore.currentCourseSession.course.slug,
|
||||
userStore.id
|
||||
)
|
||||
const assignmentDetail = computed(() =>
|
||||
assignmentStore.findAssignmentDetail(props.assignment.id)
|
||||
);
|
||||
|
||||
const learningContent = learningContents.find(
|
||||
(lc) => lc.assignmentId === props.assignment.id
|
||||
);
|
||||
|
||||
return courseSessionStore.findAssignmentDetails(learningContent?.id);
|
||||
}
|
||||
|
||||
const assignmentDetail = computed(() => findAssignmentDetail());
|
||||
|
||||
const dueDate = computed(() =>
|
||||
dayjs(assignmentDetail.value?.evaluationDeadlineDateTimeUtc)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ const emit = defineEmits(["startEvaluation"]);
|
|||
|
||||
log.debug("EvaluationIntro setup");
|
||||
|
||||
const courseSessionStore = useCourseSessionsStore();
|
||||
const courseSessionsStore = useCourseSessionsStore();
|
||||
const assignmentStore = useAssignmentStore();
|
||||
|
||||
async function startEvaluation() {
|
||||
|
|
@ -24,7 +24,7 @@ async function startEvaluation() {
|
|||
await assignmentStore.evaluateAssignmentCompletion({
|
||||
assignment_user_id: Number(props.assignmentUser.user_id),
|
||||
assignment_id: props.assignment.id,
|
||||
course_session_id: courseSessionStore.currentCourseSession!.id,
|
||||
course_session_id: courseSessionsStore.currentCourseSession!.id,
|
||||
completion_data: {},
|
||||
completion_status: "evaluation_in_progress",
|
||||
});
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ const state = reactive({
|
|||
|
||||
log.debug("EvaluationSummary setup");
|
||||
|
||||
const courseSessionStore = useCourseSessionsStore();
|
||||
const courseSessionsStore = useCourseSessionsStore();
|
||||
const assignmentStore = useAssignmentStore();
|
||||
|
||||
async function submitEvaluation() {
|
||||
|
|
@ -40,7 +40,7 @@ async function submitEvaluation() {
|
|||
await assignmentStore.evaluateAssignmentCompletion({
|
||||
assignment_user_id: Number(props.assignmentUser.user_id),
|
||||
assignment_id: props.assignment.id,
|
||||
course_session_id: courseSessionStore.currentCourseSession!.id,
|
||||
course_session_id: courseSessionsStore.currentCourseSession!.id,
|
||||
completion_data: {},
|
||||
completion_status: "evaluation_submitted",
|
||||
evaluation_grade: grade.value,
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ const props = defineProps<{
|
|||
|
||||
log.debug("EvaluationTask setup", props.taskIndex);
|
||||
|
||||
const courseSessionStore = useCourseSessionsStore();
|
||||
const courseSessionsStore = useCourseSessionsStore();
|
||||
const assignmentStore = useAssignmentStore();
|
||||
|
||||
const task = computed(() => props.assignment.evaluation_tasks[props.taskIndex]);
|
||||
|
|
@ -60,7 +60,7 @@ async function evaluateAssignmentCompletion(completionData: AssignmentCompletion
|
|||
return assignmentStore.evaluateAssignmentCompletion({
|
||||
assignment_user_id: Number(props.assignmentUser.user_id),
|
||||
assignment_id: props.assignment.id,
|
||||
course_session_id: courseSessionStore.currentCourseSession!.id,
|
||||
course_session_id: courseSessionsStore.currentCourseSession!.id,
|
||||
completion_data: completionData,
|
||||
completion_status: "evaluation_in_progress",
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<script setup lang="ts">
|
||||
import AssignmentDetails from "@/pages/cockpit/assignmentsPage/AssignmentDetails.vue";
|
||||
import { calcAssignmentLearningContents } from "@/services/assignmentService";
|
||||
import { useAssignmentStore } from "@/stores/assignmentStore";
|
||||
import { useCourseSessionsStore } from "@/stores/courseSessions";
|
||||
import { useLearningPathStore } from "@/stores/learningPath";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
|
|
@ -14,8 +15,9 @@ const props = defineProps<{
|
|||
log.debug("AssignmentsPage created", props.courseSlug);
|
||||
|
||||
const learningPathStore = useLearningPathStore();
|
||||
const courseSessionStore = useCourseSessionsStore();
|
||||
const courseSessionsStore = useCourseSessionsStore();
|
||||
const userStore = useUserStore();
|
||||
const assignmentStore = useAssignmentStore();
|
||||
|
||||
onMounted(async () => {
|
||||
log.debug("AssignmentsPage mounted");
|
||||
|
|
@ -23,22 +25,26 @@ onMounted(async () => {
|
|||
|
||||
const assignments = computed(() => {
|
||||
// TODO: filter by selected circle
|
||||
if (!courseSessionStore.currentCourseSession) {
|
||||
if (!courseSessionsStore.currentCourseSession) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return calcAssignmentLearningContents(
|
||||
learningPathStore.learningPathForUser(
|
||||
courseSessionStore.currentCourseSession.course.slug,
|
||||
courseSessionsStore.currentCourseSession.course.slug,
|
||||
userStore.id
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
const assignmentDetail = computed(
|
||||
() => (assignmentId) => assignmentStore.findAssignmentDetail(assignmentId)
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="bg-gray-200">
|
||||
<div v-if="courseSessionStore.currentCourseSession" class="container-large">
|
||||
<div v-if="courseSessionsStore.currentCourseSession" class="container-large">
|
||||
<nav class="py-4 pb-4">
|
||||
<router-link
|
||||
class="btn-text inline-flex items-center pl-0"
|
||||
|
|
@ -58,7 +64,7 @@ const assignments = computed(() => {
|
|||
<div v-for="assignment in assignments" :key="assignment.id">
|
||||
<div class="bg-white p-6">
|
||||
<AssignmentDetails
|
||||
:course-session="courseSessionStore.currentCourseSession"
|
||||
:course-session="courseSessionsStore.currentCourseSession"
|
||||
:assignment="assignment"
|
||||
/>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ const userStore = useUserStore();
|
|||
const cockpitStore = useCockpitStore();
|
||||
const competenceStore = useCompetenceStore();
|
||||
const learningPathStore = useLearningPathStore();
|
||||
const courseSessionStore = useCourseSessionsStore();
|
||||
const courseSessionsStore = useCourseSessionsStore();
|
||||
|
||||
function userCountStatusForCircle(userId: number, translationKey: string) {
|
||||
const criteria = competenceStore.flatPerformanceCriteria(
|
||||
|
|
@ -103,8 +103,8 @@ function setActiveClasses(translationKey: string) {
|
|||
<!-- Status -->
|
||||
<div class="mb-4 grid grid-rows-2 gap-4 lg:grid-cols-2 lg:grid-rows-none">
|
||||
<AssignmentsTile
|
||||
v-if="courseSessionStore.currentCourseSession"
|
||||
:course-session="courseSessionStore.currentCourseSession"
|
||||
v-if="courseSessionsStore.currentCourseSession"
|
||||
:course-session="courseSessionsStore.currentCourseSession"
|
||||
/>
|
||||
<div class="bg-white px-6 py-5">
|
||||
<h3 class="heading-3 mb-4 flex items-center gap-2">
|
||||
|
|
@ -124,8 +124,8 @@ function setActiveClasses(translationKey: string) {
|
|||
learningPathStore.learningPathForUser(props.courseSlug, userStore.id)
|
||||
?.circles || []
|
||||
"
|
||||
:course-id="courseSessionStore.currentCourseSession?.course.id || 0"
|
||||
:url="courseSessionStore.currentCourseSession?.course_url || ''"
|
||||
:course-id="courseSessionsStore.currentCourseSession?.course.id || 0"
|
||||
:url="courseSessionsStore.currentCourseSession?.course_url || ''"
|
||||
></FeedbackSummary>
|
||||
<div>
|
||||
<!-- progress -->
|
||||
|
|
|
|||
|
|
@ -115,8 +115,8 @@ async function uploadDocument(data: DocumentUploadData) {
|
|||
data,
|
||||
courseSessionsStore.currentCourseSession.id
|
||||
);
|
||||
const courseSessionStore = useCourseSessionsStore();
|
||||
courseSessionStore.addDocument(newDocument);
|
||||
const courseSessionsStore = useCourseSessionsStore();
|
||||
courseSessionsStore.addDocument(newDocument);
|
||||
showUploadModal.value = false;
|
||||
isUploading.value = false;
|
||||
} catch (error) {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ const emit = defineEmits<{
|
|||
}>();
|
||||
|
||||
const assignmentStore = useAssignmentStore();
|
||||
const courseSessionStore = useCourseSessionsStore();
|
||||
const courseSessionsStore = useCourseSessionsStore();
|
||||
const { t } = useI18n();
|
||||
|
||||
const state = reactive({
|
||||
|
|
@ -32,7 +32,7 @@ const state = reactive({
|
|||
});
|
||||
|
||||
const circleExpert = computed(() => {
|
||||
return courseSessionStore.circleExperts[0];
|
||||
return courseSessionsStore.circleExperts[0];
|
||||
});
|
||||
|
||||
const circleExpertName = computed(() => {
|
||||
|
|
@ -49,7 +49,7 @@ const onEditTask = (task: AssignmentTask) => {
|
|||
|
||||
const onSubmit = async () => {
|
||||
try {
|
||||
const courseSessionId = courseSessionStore.currentCourseSession?.id;
|
||||
const courseSessionId = courseSessionsStore.currentCourseSession?.id;
|
||||
if (!courseSessionId) {
|
||||
log.error("Invalid courseSessionId");
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@ const lastSaveUnsuccessful = ref(false);
|
|||
|
||||
const checkboxState = reactive({} as Record<string, boolean>);
|
||||
|
||||
const courseSessionStore = useCourseSessionsStore();
|
||||
const courseSessionsStore = useCourseSessionsStore();
|
||||
const assignmentStore = useAssignmentStore();
|
||||
|
||||
async function upsertAssignmentCompletion(completion_data: AssignmentCompletionData) {
|
||||
try {
|
||||
const courseSessionId = courseSessionStore.currentCourseSession?.id;
|
||||
const courseSessionId = courseSessionsStore.currentCourseSession?.id;
|
||||
if (!courseSessionId) {
|
||||
console.error("Invalid courseSessionId");
|
||||
return;
|
||||
|
|
@ -113,9 +113,9 @@ const completionStatus = computed(() => {
|
|||
</div>
|
||||
<div v-if="block.type === 'user_text_input'">
|
||||
<p
|
||||
v-if="block.value.text"
|
||||
class="text-large pb-4"
|
||||
v-html="block.value.text"
|
||||
v-if="block.value.text"
|
||||
></p>
|
||||
<ItTextarea
|
||||
:model-value="(getBlockData(block.id) as string) ?? ''"
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import { computed, onMounted, reactive } from "vue";
|
|||
import { useI18n } from "vue-i18n";
|
||||
|
||||
const { t } = useI18n();
|
||||
const courseSessionStore = useCourseSessionsStore();
|
||||
const courseSessionsStore = useCourseSessionsStore();
|
||||
const assignmentStore = useAssignmentStore();
|
||||
|
||||
interface State {
|
||||
|
|
@ -79,7 +79,7 @@ const dueDate = computed(() =>
|
|||
dayjs(state.courseSessionAssignmentDetails?.submissionDeadlineDateTimeUtc)
|
||||
);
|
||||
const courseSessionId = computed(
|
||||
() => courseSessionStore.currentCourseSession?.id ?? 0
|
||||
() => courseSessionsStore.currentCourseSession?.id ?? 0
|
||||
);
|
||||
const currentTask = computed(() => {
|
||||
if (state.pageIndex > 0 && state.pageIndex <= numTasks.value) {
|
||||
|
|
|
|||
|
|
@ -183,11 +183,11 @@ router.beforeEach(updateLoggedIn);
|
|||
router.beforeEach(redirectToLoginIfRequired);
|
||||
|
||||
router.beforeEach((to) => {
|
||||
const courseSessionStore = useCourseSessionsStore();
|
||||
const courseSessionsStore = useCourseSessionsStore();
|
||||
if (to.params.courseSlug) {
|
||||
courseSessionStore._currentCourseSlug = to.params.courseSlug as string;
|
||||
courseSessionsStore._currentCourseSlug = to.params.courseSlug as string;
|
||||
} else {
|
||||
courseSessionStore._currentCourseSlug = "";
|
||||
courseSessionsStore._currentCourseSlug = "";
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
import { itGet, itPost } from "@/fetchHelpers";
|
||||
import { calcAssignmentLearningContents } from "@/services/assignmentService";
|
||||
import { useCourseSessionsStore } from "@/stores/courseSessions";
|
||||
import { useLearningPathStore } from "@/stores/learningPath";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
import type {
|
||||
Assignment,
|
||||
AssignmentCompletion,
|
||||
|
|
@ -78,5 +82,29 @@ export const useAssignmentStore = defineStore({
|
|||
}
|
||||
return responseData;
|
||||
},
|
||||
|
||||
findAssignmentDetail(assignmentId: number) {
|
||||
const learningPathStore = useLearningPathStore();
|
||||
const userStore = useUserStore();
|
||||
const courseSessionsStore = useCourseSessionsStore();
|
||||
|
||||
// TODO: filter by selected circle
|
||||
if (!courseSessionsStore.currentCourseSession) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const learningContents = calcAssignmentLearningContents(
|
||||
learningPathStore.learningPathForUser(
|
||||
courseSessionsStore.currentCourseSession.course.slug,
|
||||
userStore.id
|
||||
)
|
||||
);
|
||||
|
||||
const learningContent = learningContents.find(
|
||||
(lc) => lc.assignmentId === assignmentId
|
||||
);
|
||||
|
||||
return courseSessionsStore.findAssignmentDetails(learningContent?.id);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue