Rename composable to useCourseData
This commit is contained in:
parent
00357ad4f3
commit
0c40bb9341
|
|
@ -2,7 +2,7 @@
|
|||
import LearningPathCircle from "@/pages/learningPath/learningPathPage/LearningPathCircle.vue";
|
||||
import { calculateCircleSectorData } from "@/pages/learningPath/learningPathPage/utils";
|
||||
import { computed } from "vue";
|
||||
import { useLearningPathWithCompletion } from "@/composables";
|
||||
import { useCourseDataWithCompletion } from "@/composables";
|
||||
|
||||
export type DiagramType = "horizontal" | "horizontalSmall" | "singleSmall";
|
||||
|
||||
|
|
@ -20,7 +20,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|||
userId: undefined,
|
||||
});
|
||||
|
||||
const lpQueryResult = useLearningPathWithCompletion(
|
||||
const lpQueryResult = useCourseDataWithCompletion(
|
||||
props.courseSlug,
|
||||
props.userId,
|
||||
props.courseSessionId
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ export function flatCircles(learningPath: LearningPathType) {
|
|||
return learningPath.topics.flatMap((t) => t.circles);
|
||||
}
|
||||
|
||||
export function useLearningPath(courseSlug: string) {
|
||||
export function useCourseData(courseSlug: string) {
|
||||
const learningPath = ref<LearningPathType | undefined>(undefined);
|
||||
const actionCompetences = ref<ActionCompetence[]>([]);
|
||||
const course = ref<Course | undefined>(undefined);
|
||||
|
|
@ -278,7 +278,7 @@ export function useLearningPath(courseSlug: string) {
|
|||
};
|
||||
}
|
||||
|
||||
export function useLearningPathWithCompletion(
|
||||
export function useCourseDataWithCompletion(
|
||||
courseSlug?: string,
|
||||
userId?: string,
|
||||
courseSessionId?: string
|
||||
|
|
@ -293,7 +293,7 @@ export function useLearningPathWithCompletion(
|
|||
courseSessionId = useCurrentCourseSession().value.id;
|
||||
}
|
||||
|
||||
const courseResult = useLearningPath(courseSlug);
|
||||
const courseResult = useCourseData(courseSlug);
|
||||
const completionStore = useCompletionStore();
|
||||
const nextLearningContent = ref<LearningContentWithCompletion | undefined>(undefined);
|
||||
const loaded = ref(false);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { useTranslation } from "i18next-vue";
|
|||
import ItDropdownSelect from "@/components/ui/ItDropdownSelect.vue";
|
||||
import type { DueDate } from "@/types";
|
||||
import DueDatesList from "@/components/dueDates/DueDatesList.vue";
|
||||
import { useLearningPath } from "@/composables";
|
||||
import { useCourseData } from "@/composables";
|
||||
|
||||
const { t } = useTranslation();
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ const selectedCircle = ref<Item>(circles.value[0]);
|
|||
|
||||
async function loadCircleValues() {
|
||||
if (selectedCourse.value) {
|
||||
const learningPathQuery = useLearningPath(selectedCourse.value.slug);
|
||||
const learningPathQuery = useCourseData(selectedCourse.value.slug);
|
||||
await learningPathQuery.resultPromise;
|
||||
circles.value = [
|
||||
initialItemCircle,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<script setup lang="ts">
|
||||
import {
|
||||
useCourseSessionDetailQuery,
|
||||
useLearningPathWithCompletion,
|
||||
useCourseDataWithCompletion,
|
||||
} from "@/composables";
|
||||
import { useCockpitStore } from "@/stores/cockpit";
|
||||
import * as log from "loglevel";
|
||||
|
|
@ -28,7 +28,7 @@ onMounted(async () => {
|
|||
courseSessionDetailResult.findCurrentUser()
|
||||
);
|
||||
const userDataPromises = courseSessionDetailResult.filterMembers().map((m) => {
|
||||
const completionData = useLearningPathWithCompletion(props.courseSlug, m.id);
|
||||
const completionData = useCourseDataWithCompletion(props.courseSlug, m.id);
|
||||
return completionData.resultPromise;
|
||||
});
|
||||
await Promise.all(userDataPromises);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import CompetenceDetail from "@/pages/competence/ActionCompetenceDetail.vue";
|
|||
import LearningPathPathView from "@/pages/learningPath/learningPathPage/LearningPathPathView.vue";
|
||||
import {
|
||||
useCourseSessionDetailQuery,
|
||||
useLearningPathWithCompletion,
|
||||
useCourseDataWithCompletion,
|
||||
} from "@/composables";
|
||||
|
||||
const props = defineProps<{
|
||||
|
|
@ -16,7 +16,7 @@ const props = defineProps<{
|
|||
|
||||
log.debug("CockpitUserProfilePage created", props.userId);
|
||||
|
||||
const courseCompletionData = useLearningPathWithCompletion(
|
||||
const courseCompletionData = useCourseDataWithCompletion(
|
||||
props.courseSlug,
|
||||
props.userId
|
||||
);
|
||||
|
|
@ -25,7 +25,7 @@ onMounted(async () => {
|
|||
log.debug("CockpitUserProfilePage mounted");
|
||||
});
|
||||
|
||||
const lpQueryResult = useLearningPathWithCompletion(props.courseSlug, props.userId);
|
||||
const lpQueryResult = useCourseDataWithCompletion(props.courseSlug, props.userId);
|
||||
|
||||
const learningPath = computed(() => {
|
||||
return lpQueryResult.learningPath.value;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import { useCurrentCourseSession, useLearningPath } from "@/composables";
|
||||
import { useCurrentCourseSession, useCourseData } from "@/composables";
|
||||
import AssignmentDetails from "@/pages/cockpit/assignmentsPage/AssignmentDetails.vue";
|
||||
import * as log from "loglevel";
|
||||
import { computed, onMounted } from "vue";
|
||||
|
|
@ -18,7 +18,7 @@ onMounted(async () => {
|
|||
log.debug("AssignmentsPage mounted");
|
||||
});
|
||||
|
||||
const lpQueryResult = useLearningPath(props.courseSlug);
|
||||
const lpQueryResult = useCourseData(props.courseSlug);
|
||||
|
||||
const learningContentAssignment = computed(() => {
|
||||
return lpQueryResult.findLearningContent(props.assignmentId);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import FeedbackSubmissionProgress from "@/pages/cockpit/cockpitPage/FeedbackSubm
|
|||
import { learningContentTypeData } from "@/utils/typeMaps";
|
||||
import {
|
||||
useCourseSessionDetailQuery,
|
||||
useLearningPathWithCompletion,
|
||||
useCourseDataWithCompletion,
|
||||
} from "@/composables";
|
||||
import { circleFlatLearningContents } from "@/services/circle";
|
||||
|
||||
|
|
@ -39,7 +39,7 @@ const courseSessionDetailResult = useCourseSessionDetailQuery();
|
|||
|
||||
const { t } = useTranslation();
|
||||
|
||||
const lpQueryResult = useLearningPathWithCompletion();
|
||||
const lpQueryResult = useCourseDataWithCompletion();
|
||||
|
||||
const submittables = computed(() => {
|
||||
if (!lpQueryResult.circles.value?.length) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import { useLearningPathWithCompletion } from "@/composables";
|
||||
import { useCourseDataWithCompletion } from "@/composables";
|
||||
import { computed } from "vue";
|
||||
import { calcPerformanceCriteriaStatusCount } from "@/services/competence";
|
||||
|
||||
|
|
@ -9,7 +9,7 @@ const props = defineProps<{
|
|||
circleId?: string;
|
||||
}>();
|
||||
|
||||
const courseData = useLearningPathWithCompletion(props.courseSlug, props.userId);
|
||||
const courseData = useCourseDataWithCompletion(props.courseSlug, props.userId);
|
||||
|
||||
const circleStatusCount = computed(() => {
|
||||
if (props.circleId) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import { useCurrentCourseSession, useLearningPath } from "@/composables";
|
||||
import { useCurrentCourseSession, useCourseData } from "@/composables";
|
||||
import ItDropdownSelect from "@/components/ui/ItDropdownSelect.vue";
|
||||
import { useCockpitStore } from "@/stores/cockpit";
|
||||
import ItModal from "@/components/ui/ItModal.vue";
|
||||
|
|
@ -20,7 +20,7 @@ import DocumentListItem from "@/components/circle/DocumentListItem.vue";
|
|||
const cockpitStore = useCockpitStore();
|
||||
const courseSession = useCurrentCourseSession();
|
||||
const courseSessionsStore = useCourseSessionsStore();
|
||||
const courseData = useLearningPath(courseSession.value?.course.slug);
|
||||
const courseData = useCourseData(courseSession.value?.course.slug);
|
||||
|
||||
const { t } = useTranslation();
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
import CompetenceDetail from "@/pages/competence/ActionCompetenceDetail.vue";
|
||||
import * as log from "loglevel";
|
||||
import { ref } from "vue";
|
||||
import { useLearningPathWithCompletion } from "@/composables";
|
||||
import { useCourseDataWithCompletion } from "@/composables";
|
||||
|
||||
log.debug("CompetenceListPage created");
|
||||
|
||||
|
|
@ -10,7 +10,7 @@ const props = defineProps<{
|
|||
courseSlug: string;
|
||||
}>();
|
||||
|
||||
const courseData = useLearningPathWithCompletion(props.courseSlug);
|
||||
const courseData = useCourseDataWithCompletion(props.courseSlug);
|
||||
|
||||
const isOpenAll = ref(false);
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { COMPETENCE_NAVI_CERTIFICATE_QUERY } from "@/graphql/queries";
|
|||
import { useQuery } from "@urql/vue";
|
||||
import { computed } from "vue";
|
||||
import type { CompetenceCertificate } from "@/types";
|
||||
import { useCurrentCourseSession, useLearningPathWithCompletion } from "@/composables";
|
||||
import { useCurrentCourseSession, useCourseDataWithCompletion } from "@/composables";
|
||||
import {
|
||||
assignmentsMaxEvaluationPoints,
|
||||
assignmentsUserPoints,
|
||||
|
|
@ -20,7 +20,7 @@ const props = defineProps<{
|
|||
log.debug("CompetenceIndexPage setup", props);
|
||||
|
||||
const courseSession = useCurrentCourseSession();
|
||||
const courseData = useLearningPathWithCompletion(props.courseSlug);
|
||||
const courseData = useCourseDataWithCompletion(props.courseSlug);
|
||||
|
||||
const certificatesQuery = useQuery({
|
||||
query: COMPETENCE_NAVI_CERTIFICATE_QUERY,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
import * as log from "loglevel";
|
||||
import { computed } from "vue";
|
||||
import _ from "lodash";
|
||||
import { useLearningPathWithCompletion } from "@/composables";
|
||||
import { useCourseDataWithCompletion } from "@/composables";
|
||||
|
||||
const props = defineProps<{
|
||||
courseSlug: string;
|
||||
|
|
@ -10,7 +10,7 @@ const props = defineProps<{
|
|||
|
||||
log.debug("PerformanceCriteriaPage created", props);
|
||||
|
||||
const courseCompletionData = useLearningPathWithCompletion(props.courseSlug);
|
||||
const courseCompletionData = useCourseDataWithCompletion(props.courseSlug);
|
||||
|
||||
const uniqueLearningUnits = computed(() => {
|
||||
// FIXME: this complex calculation can go away,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import CircleOverview from "./CircleOverview.vue";
|
|||
import DocumentSection from "./DocumentSection.vue";
|
||||
import {
|
||||
useCourseSessionDetailQuery,
|
||||
useLearningPathWithCompletion,
|
||||
useCourseDataWithCompletion,
|
||||
} from "@/composables";
|
||||
import { stringifyParse } from "@/utils/utils";
|
||||
import { useCircleStore } from "@/stores/circle";
|
||||
|
|
@ -32,7 +32,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|||
|
||||
log.debug("CirclePage created", stringifyParse(props));
|
||||
|
||||
const lpQueryResult = useLearningPathWithCompletion(
|
||||
const lpQueryResult = useCourseDataWithCompletion(
|
||||
props.courseSlug,
|
||||
props.profileUser?.user_id
|
||||
);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import {
|
|||
circleFlatLearningContents,
|
||||
someFinishedInLearningSequence,
|
||||
} from "@/services/circle";
|
||||
import { useLearningPathWithCompletion } from "@/composables";
|
||||
import { useCourseDataWithCompletion } from "@/composables";
|
||||
import { findLastIndex } from "lodash";
|
||||
|
||||
type Props = {
|
||||
|
|
@ -40,7 +40,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|||
|
||||
const circleStore = useCircleStore();
|
||||
|
||||
const lpQueryResult = useLearningPathWithCompletion(props.courseSlug);
|
||||
const lpQueryResult = useCourseDataWithCompletion(props.courseSlug);
|
||||
|
||||
function toggleCompleted(learningContent: LearningContentWithCompletion) {
|
||||
let completionStatus: CourseCompletionStatus = "SUCCESS";
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
import LearningContentParent from "@/pages/learningPath/learningContentPage/LearningContentParent.vue";
|
||||
import * as log from "loglevel";
|
||||
import { computed, getCurrentInstance, onUpdated } from "vue";
|
||||
import { useLearningPathWithCompletion } from "@/composables";
|
||||
import { useCourseDataWithCompletion } from "@/composables";
|
||||
import { stringifyParse } from "@/utils/utils";
|
||||
|
||||
const props = defineProps<{
|
||||
|
|
@ -13,7 +13,7 @@ const props = defineProps<{
|
|||
|
||||
log.debug("LearningContentView created", stringifyParse(props));
|
||||
|
||||
const courseData = useLearningPathWithCompletion(props.courseSlug);
|
||||
const courseData = useCourseDataWithCompletion(props.courseSlug);
|
||||
const learningContent = computed(() =>
|
||||
courseData.findLearningContent(props.contentSlug, props.circleSlug)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import RichTextBlock from "./blocks/RichTextBlock.vue";
|
|||
import VideoBlock from "./blocks/VideoBlock.vue";
|
||||
import { getPreviousRoute } from "@/router/history";
|
||||
import { stringifyParse } from "@/utils/utils";
|
||||
import { useLearningPathWithCompletion } from "@/composables";
|
||||
import { useCourseDataWithCompletion } from "@/composables";
|
||||
import { useCircleStore } from "@/stores/circle";
|
||||
|
||||
const props = defineProps<{
|
||||
|
|
@ -32,7 +32,7 @@ const props = defineProps<{
|
|||
|
||||
log.debug("LearningContentParent setup", stringifyParse(props));
|
||||
|
||||
const courseCompletionData = useLearningPathWithCompletion();
|
||||
const courseCompletionData = useCourseDataWithCompletion();
|
||||
const circleStore = useCircleStore();
|
||||
|
||||
const previousRoute = getPreviousRoute();
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import ItSuccessAlert from "@/components/ui/ItSuccessAlert.vue";
|
|||
import {
|
||||
useCourseSessionDetailQuery,
|
||||
useCurrentCourseSession,
|
||||
useLearningPath,
|
||||
useCourseData,
|
||||
} from "@/composables";
|
||||
import { bustItGetCache } from "@/fetchHelpers";
|
||||
import { UPSERT_ASSIGNMENT_COMPLETION_MUTATION } from "@/graphql/mutations";
|
||||
|
|
@ -34,7 +34,7 @@ const emit = defineEmits<{
|
|||
|
||||
const courseSession = useCurrentCourseSession();
|
||||
const courseSessionDetailResult = useCourseSessionDetailQuery();
|
||||
const courseData = useLearningPath(courseSession.value.course.slug);
|
||||
const courseData = useCourseData(courseSession.value.course.slug);
|
||||
|
||||
const { t } = useTranslation();
|
||||
|
||||
|
|
@ -142,7 +142,7 @@ const onSubmit = async () => {
|
|||
data-cy="confirm-submit-person"
|
||||
@toggle="state.confirmPerson = !state.confirmPerson"
|
||||
></ItCheckbox>
|
||||
<div class="flex flex-row items-center pb-6 pl-[49px]" v-if="circleExpert">
|
||||
<div v-if="circleExpert" class="flex flex-row items-center pb-6 pl-[49px]">
|
||||
<img
|
||||
alt="Notification icon"
|
||||
class="mr-2 h-[45px] min-w-[45px] rounded-full"
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import type { ViewType } from "@/pages/learningPath/learningPathPage/LearningPat
|
|||
import LearningPathViewSwitch from "@/pages/learningPath/learningPathPage/LearningPathViewSwitch.vue";
|
||||
import { breakpointsTailwind, useBreakpoints } from "@vueuse/core";
|
||||
import { computed, ref } from "vue";
|
||||
import { useLearningPathWithCompletion } from "@/composables";
|
||||
import { useCourseDataWithCompletion } from "@/composables";
|
||||
import { someFinishedInLearningSequence } from "@/services/circle";
|
||||
|
||||
const props = defineProps<{
|
||||
|
|
@ -23,7 +23,7 @@ const selectedView = ref<ViewType>(
|
|||
(window.localStorage.getItem("learningPathView") as ViewType) || "path"
|
||||
);
|
||||
|
||||
const lpQueryResult = useLearningPathWithCompletion(props.courseSlug);
|
||||
const lpQueryResult = useCourseDataWithCompletion(props.courseSlug);
|
||||
|
||||
const learningPath = computed(() => lpQueryResult.learningPath.value);
|
||||
const course = computed(() => lpQueryResult.course.value);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { useCircleStore } from "@/stores/circle";
|
|||
import type { CircleType, LearningUnit } from "@/types";
|
||||
import * as log from "loglevel";
|
||||
|
||||
import { useCurrentCourseSession, useLearningPathWithCompletion } from "@/composables";
|
||||
import { useCurrentCourseSession, useCourseDataWithCompletion } from "@/composables";
|
||||
import LearningContentContainer from "@/pages/learningPath/learningContentPage/LearningContentContainer.vue";
|
||||
import LearningContentMultiLayout from "@/pages/learningPath/learningContentPage/layouts/LearningContentMultiLayout.vue";
|
||||
import eventBus from "@/utils/eventBus";
|
||||
|
|
@ -16,7 +16,7 @@ log.debug("LearningContent.vue setup");
|
|||
|
||||
const circleStore = useCircleStore();
|
||||
const courseSession = useCurrentCourseSession();
|
||||
const courseCompletionData = useLearningPathWithCompletion();
|
||||
const courseCompletionData = useCourseDataWithCompletion();
|
||||
|
||||
const questionIndex = useRouteQuery("step", "0", { transform: Number, mode: "push" });
|
||||
const previousRoute = getPreviousRoute();
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import * as log from "loglevel";
|
|||
|
||||
import SelfEvaluation from "@/pages/learningPath/selfEvaluationPage/SelfEvaluation.vue";
|
||||
import { computed } from "vue";
|
||||
import { useLearningPathWithCompletion } from "@/composables";
|
||||
import { useCourseDataWithCompletion } from "@/composables";
|
||||
|
||||
log.debug("LearningUnitSelfEvaluationView created");
|
||||
|
||||
|
|
@ -13,7 +13,7 @@ const props = defineProps<{
|
|||
learningUnitSlug: string;
|
||||
}>();
|
||||
|
||||
const courseData = useLearningPathWithCompletion(props.courseSlug);
|
||||
const courseData = useCourseDataWithCompletion(props.courseSlug);
|
||||
const learningUnit = computed(() =>
|
||||
courseData.findLearningUnit(props.learningUnitSlug, props.circleSlug)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { useLearningPath } from "@/composables";
|
||||
import { useCourseData } from "@/composables";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
import type { CircleLight, CourseSessionUser, ExpertSessionUser } from "@/types";
|
||||
import log from "loglevel";
|
||||
|
|
@ -59,7 +59,7 @@ async function courseCircles(
|
|||
const userStore = useUserStore();
|
||||
// Return all circles from learning path for admin users
|
||||
if (userStore.is_superuser) {
|
||||
const lpQueryResult = useLearningPath(courseSlug);
|
||||
const lpQueryResult = useCourseData(courseSlug);
|
||||
await lpQueryResult.resultPromise;
|
||||
|
||||
return (lpQueryResult.circles.value ?? []).map((c) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue