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