Clean up code to make typechecker happy
This commit is contained in:
parent
a4a93a2214
commit
5bcfda9156
|
|
@ -182,6 +182,10 @@ const nextStep = () => {
|
||||||
const sendFeedback = () => {
|
const sendFeedback = () => {
|
||||||
log.info("sending feedback");
|
log.info("sending feedback");
|
||||||
const courseSession = courseSessionsStore.courseSessionForRoute;
|
const courseSession = courseSessionsStore.courseSessionForRoute;
|
||||||
|
if (!courseSession || !courseSession.id) {
|
||||||
|
log.error("no course session set");
|
||||||
|
return;
|
||||||
|
}
|
||||||
const input: SendFeedbackInput = reactive({
|
const input: SendFeedbackInput = reactive({
|
||||||
materialsRating,
|
materialsRating,
|
||||||
courseNegativeFeedback,
|
courseNegativeFeedback,
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="container-medium">
|
<div class="container-medium">
|
||||||
<div class="mt-4 lg:mt-12">
|
<div class="mt-4 lg:mt-12">
|
||||||
<Feedback :page="content" />
|
<FeedbackForm :page="content" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Feedback from "@/components/Feedback.vue";
|
import FeedbackForm from "@/components/FeedbackForm.vue";
|
||||||
import type { LearningContent } from "@/types";
|
import type { LearningContent } from "@/types";
|
||||||
|
|
||||||
interface Value {
|
interface Value {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
<div class="flex flex-col justify-start align-items-start justify-items-start">
|
<div class="flex flex-col justify-start align-items-start justify-items-start">
|
||||||
<ItCheckbox
|
<ItCheckbox
|
||||||
v-for="item in items"
|
v-for="item in items"
|
||||||
:key="item.id"
|
:key="item.value"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
class="mb-4"
|
class="mb-4"
|
||||||
/>
|
/>
|
||||||
|
|
@ -20,12 +20,6 @@
|
||||||
import type { RadioItem } from "@/components/learningPath/feedback.types";
|
import type { RadioItem } from "@/components/learningPath/feedback.types";
|
||||||
|
|
||||||
import ItCheckbox from "@/components/ui/ItCheckbox.vue";
|
import ItCheckbox from "@/components/ui/ItCheckbox.vue";
|
||||||
import {
|
|
||||||
RadioGroup,
|
|
||||||
// RadioGroupDescription,
|
|
||||||
RadioGroupLabel,
|
|
||||||
RadioGroupOption,
|
|
||||||
} from "@headlessui/vue";
|
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
modelValue: any;
|
modelValue: any;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
export const COMPLETION_SUCCESS = "success";
|
import type { CourseCompletionStatus } from "@/types";
|
||||||
export const COMPLETION_FAILURE = "fail";
|
|
||||||
export const COMPLETION_UNKNOWN = "unknown";
|
export const COMPLETION_SUCCESS: CourseCompletionStatus = "success";
|
||||||
|
export const COMPLETION_FAILURE: CourseCompletionStatus = "fail";
|
||||||
|
export const COMPLETION_UNKNOWN: CourseCompletionStatus = "unknown";
|
||||||
|
|
|
||||||
|
|
@ -67,47 +67,3 @@ export const useSetupCourseSessionsStore = defineStore("courseSessionsSetup", ()
|
||||||
hasCockpit,
|
hasCockpit,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
export const useOptionsCourseSessionsStore = defineStore({
|
|
||||||
id: "courseSessions",
|
|
||||||
state: () => {
|
|
||||||
return {
|
|
||||||
courseSessions: [] as CourseSession[],
|
|
||||||
};
|
|
||||||
},
|
|
||||||
getters: {
|
|
||||||
courseSessionForRoute: (state): CourseSession | undefined => {
|
|
||||||
const route = useRoute();
|
|
||||||
const routePath = decodeURI(route.path);
|
|
||||||
return state.courseSessions?.find((cs) => {
|
|
||||||
return routePath.startsWith(cs.course_url);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
coursesFromCourseSessions: (state) => {
|
|
||||||
if (state.courseSessions) {
|
|
||||||
return _.uniqBy(state.courseSessions, "course.id");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
hasCockpit() {
|
|
||||||
const userStore = useUserStore();
|
|
||||||
return (
|
|
||||||
this.courseSessionForRoute &&
|
|
||||||
(this.courseSessionForRoute as unknown as CourseSession).experts.filter(
|
|
||||||
(expert) => expert.user_id === userStore.id
|
|
||||||
).length > 0
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
async loadCourseSessionsData(reload = false) {
|
|
||||||
log.debug("loadCourseSessionsData called");
|
|
||||||
this.courseSessions = await itGetCached(`/api/course/sessions/`, {
|
|
||||||
reload: reload,
|
|
||||||
});
|
|
||||||
if (!this.courseSessions) {
|
|
||||||
throw `No courseSessionData found for user`;
|
|
||||||
}
|
|
||||||
return this.courseSessions;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
|
||||||
|
|
@ -30,5 +30,5 @@ export function learningContentTypeData(t: LearningContentType): {
|
||||||
return { title: "In Umsetzung", icon: "it-icon-lc-document" };
|
return { title: "In Umsetzung", icon: "it-icon-lc-document" };
|
||||||
}
|
}
|
||||||
|
|
||||||
return assertUnreachable(t);
|
return assertUnreachable();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue