refactor(backend): Ondersteuning voor gepersonaliseerde leerpaden toegevoegd.

This commit is contained in:
Gerald Schmittinger 2025-04-01 00:31:16 +02:00
parent a17e2b2793
commit dc99835a9d
3 changed files with 99 additions and 78 deletions

View file

@ -16,7 +16,7 @@ export function useGetLearningPathQuery(
queryKey: [LEARNING_PATH_KEY, "get", hruid, language, options],
queryFn: () => {
const [hruidVal, languageVal, optionsVal] = [toValue(hruid), toValue(language), toValue(options)];
return learningPathController.getBy(hruidVal, languageVal)
return learningPathController.getBy(hruidVal, languageVal, optionsVal)
},
enabled: () => Boolean(toValue(hruid)) && Boolean(toValue(language)),
})

View file

@ -18,10 +18,15 @@ const learningObjectHtmlQueryResult: UseQueryReturnType<Document, Error> = useLe
<style scoped>
.learning-object-container {
margin: 20px;
padding: 20px;
}
:deep(hr) {
margin-top: 10px;
margin-bottom: 10px;
}
:deep(li) {
margin-left: 30px;
margin-top: 5px;
margin-bottom: 5px;
}
</style>

View file

@ -11,6 +11,7 @@
import {useGetLearningPathQuery} from "@/queries/learning-paths.ts";
import {useLearningObjectListForPathQuery} from "@/queries/learning-objects.ts";
import UsingQueryResult from "@/components/UsingQueryResult.vue";
import authService from "@/services/auth/auth-service.ts";
const router = useRouter();
const route = useRoute();
@ -18,14 +19,29 @@
const props = defineProps<{hruid: string, language: Language, learningObjectHruid?: string}>()
interface QueryParams {
interface Personalization {
forStudent?: string,
forGroup?: string
}
const typedQuery = computed(() => route.query as QueryParams)
const personalization = computed(() => {
if (route.query.forStudent || route.query.forGroup) {
return {
forStudent: route.query.forStudent,
forGroup: route.query.forGroup
} as Personalization
} else {
return {
forStudent: authService.authState.user?.profile?.preferred_username
} as Personalization
}
});
const learningPathQueryResult = useGetLearningPathQuery(props.hruid, props.language, typedQuery.value);
const learningPathQueryResult = useGetLearningPathQuery(
props.hruid,
props.language,
personalization
);
const learningObjectListQueryResult = useLearningObjectListForPathQuery(learningPathQueryResult.data);