feat: huidig leerpad wordt in inhoudstafel getoond met zijn leerobjecten waarop je kan klikken
This commit is contained in:
		
							parent
							
								
									f318bb296b
								
							
						
					
					
						commit
						f3690902d1
					
				
					 1 changed files with 41 additions and 12 deletions
				
			
		|  | @ -7,7 +7,7 @@ | ||||||
|     import LearningObjectView from "@/views/learning-paths/learning-object/LearningObjectView.vue"; |     import LearningObjectView from "@/views/learning-paths/learning-object/LearningObjectView.vue"; | ||||||
|     import { useI18n } from "vue-i18n"; |     import { useI18n } from "vue-i18n"; | ||||||
|     import LearningPathSearchField from "@/components/LearningPathSearchField.vue"; |     import LearningPathSearchField from "@/components/LearningPathSearchField.vue"; | ||||||
|     import { useGetLearningPathQuery } from "@/queries/learning-paths.ts"; |     import { useGetAllLearningPaths, useGetLearningPathQuery } from "@/queries/learning-paths.ts"; | ||||||
|     import { useLearningObjectListForPathQuery } from "@/queries/learning-objects.ts"; |     import { useLearningObjectListForPathQuery } from "@/queries/learning-objects.ts"; | ||||||
|     import UsingQueryResult from "@/components/UsingQueryResult.vue"; |     import UsingQueryResult from "@/components/UsingQueryResult.vue"; | ||||||
|     import authService from "@/services/auth/auth-service.ts"; |     import authService from "@/services/auth/auth-service.ts"; | ||||||
|  | @ -21,7 +21,7 @@ | ||||||
|     import { useStudentAssignmentsQuery, useStudentGroupsQuery } from "@/queries/students"; |     import { useStudentAssignmentsQuery, useStudentGroupsQuery } from "@/queries/students"; | ||||||
|     import type { AssignmentDTO } from "@dwengo-1/common/interfaces/assignment"; |     import type { AssignmentDTO } from "@dwengo-1/common/interfaces/assignment"; | ||||||
|     import type { GroupDTO } from "@dwengo-1/common/interfaces/group"; |     import type { GroupDTO } from "@dwengo-1/common/interfaces/group"; | ||||||
|     import QuestionNotification from "@/components/QuestionNotification.vue"; |     import DiscussionSideBarElement from "@/components/DiscussionSideBarElement.vue"; | ||||||
| 
 | 
 | ||||||
|     const router = useRouter(); |     const router = useRouter(); | ||||||
|     const route = useRoute(); |     const route = useRoute(); | ||||||
|  | @ -52,6 +52,33 @@ | ||||||
|         return undefined; |         return undefined; | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|  |     const allLearningPathsResult = useGetAllLearningPaths(props.language) | ||||||
|  |      | ||||||
|  |     // TODO: dit moet alle leerpaden met vragen teruggeven, maar werkt niet | ||||||
|  |     const questionedLearningPaths = computed(() => { | ||||||
|  |         function objectHasQuestion(learningObject: LearningObject) { | ||||||
|  |             const loid = { | ||||||
|  |                 hruid: learningObject.key, | ||||||
|  |                 version: learningObject.version, | ||||||
|  |                 language: learningObject.language, | ||||||
|  |             } as LearningObjectIdentifierDTO; | ||||||
|  |             const { data } = useQuestionsQuery(loid); | ||||||
|  |             const hasQuestions = computed(() => (data.value?.questions.length ?? 0) > 0); | ||||||
|  |             return hasQuestions; | ||||||
|  |         } | ||||||
|  |         function pathHasQuestion(learningPath: LearningPath) { | ||||||
|  |             const learningPathQueryResult = useGetLearningPathQuery(learningPath.hruid, learningPath.language as Language, forGroup); | ||||||
|  |             const learningObjectListQueryResult = useLearningObjectListForPathQuery(learningPathQueryResult.data); | ||||||
|  |             const learningObjects = learningObjectListQueryResult.data.value; | ||||||
|  |             console.log("Path: " + learningPath.hruid) | ||||||
|  |             console.log(learningObjects) | ||||||
|  |             console.log("questions: " + learningObjects?.some(objectHasQuestion)) | ||||||
|  |             return learningObjects?.some(objectHasQuestion); | ||||||
|  | 
 | ||||||
|  |         } | ||||||
|  |         return allLearningPathsResult.data.value?.filter(pathHasQuestion); | ||||||
|  |     }) | ||||||
|  | 
 | ||||||
|     const learningPathQueryResult = useGetLearningPathQuery(props.hruid, props.language, forGroup); |     const learningPathQueryResult = useGetLearningPathQuery(props.hruid, props.language, forGroup); | ||||||
| 
 | 
 | ||||||
|     const learningObjectListQueryResult = useLearningObjectListForPathQuery(learningPathQueryResult.data); |     const learningObjectListQueryResult = useLearningObjectListForPathQuery(learningPathQueryResult.data); | ||||||
|  | @ -163,24 +190,25 @@ | ||||||
|             <div class="d-flex flex-column h-100"> |             <div class="d-flex flex-column h-100"> | ||||||
|                 <v-list-item> |                 <v-list-item> | ||||||
|                     <template v-slot:title> |                     <template v-slot:title> | ||||||
|                         <div class="learning-path-title">Learning paths with questions</div> |                         <div class="learning-path-title">Discussions</div> | ||||||
|                     </template> |                     </template> | ||||||
|                 </v-list-item> |                 </v-list-item> | ||||||
|                 <v-divider></v-divider> |                 <v-divider></v-divider> | ||||||
|                 <div v-if="props.learningObjectHruid"> |                 <div v-if="props.learningObjectHruid"> | ||||||
|  |                     <DiscussionSideBarElement | ||||||
|  |                         :path="(learningPathQueryResult.data.value as LearningPath)" | ||||||
|  |                         :activeObjectId="props.learningObjectHruid"> | ||||||
|  |                     </DiscussionSideBarElement> | ||||||
|                     <using-query-result |                     <using-query-result | ||||||
|                         :query-result="learningObjectListQueryResult" |                         :query-result="learningObjectListQueryResult" | ||||||
|                         v-slot="learningObjects: { data: LearningObject[] }" |                         v-slot="learningObjects: {data: LearningObject[]}"> | ||||||
|                     > |                             <v-list-item  | ||||||
|                         <template v-for="node in learningObjects.data"> |  | ||||||
|                             <v-list-item |  | ||||||
|                                 link |                                 link | ||||||
|                                 :to="{ path: node.key, query: route.query }" |                                 :to="{ path: learningObject.key, query: route.query }" | ||||||
|                                 :title="node.title" |                                 :title="learningObject.title" | ||||||
|                                 :active="node.key === props.learningObjectHruid" |                                 :active="learningObject.key === props.learningObjectHruid" | ||||||
|                             > |                                 v-for="learningObject in learningObjects.data"> | ||||||
|                             </v-list-item> |                             </v-list-item> | ||||||
|                         </template> |  | ||||||
|                     </using-query-result> |                     </using-query-result> | ||||||
|                 </div> |                 </div> | ||||||
|             </div> |             </div> | ||||||
|  | @ -215,6 +243,7 @@ | ||||||
| </template> | </template> | ||||||
| 
 | 
 | ||||||
| <style scoped> | <style scoped> | ||||||
|  | 
 | ||||||
|     .learning-path-title { |     .learning-path-title { | ||||||
|         white-space: normal; |         white-space: normal; | ||||||
|     } |     } | ||||||
|  |  | ||||||
		Reference in a new issue
	
	 Timo De Meyst
						Timo De Meyst