feat: poging tot precomputen van check of leerobjecten vragen hebben
This commit is contained in:
		
							parent
							
								
									e07c206ef1
								
							
						
					
					
						commit
						103742db31
					
				
					 1 changed files with 26 additions and 3 deletions
				
			
		|  | @ -192,7 +192,30 @@ | ||||||
|         } else { |         } else { | ||||||
|             alert("Please type a question before submitting.") // TODO: i18n |             alert("Please type a question before submitting.") // TODO: i18n | ||||||
|         } |         } | ||||||
|  |     } | ||||||
|      |      | ||||||
|  |     const learningObjectHasQuestions = computed(() => { | ||||||
|  |         const result = new Map<string, boolean>(); | ||||||
|  |         const learningObjects = learningObjectListQueryResult.data?.value ?? []; | ||||||
|  | 
 | ||||||
|  |         learningObjects.forEach((learningObject) => { | ||||||
|  |             const nodeLoId: LearningObjectIdentifierDTO = { | ||||||
|  |                 hruid: learningObject.key, | ||||||
|  |                 language: learningObject.language, | ||||||
|  |                 version: learningObject.version | ||||||
|  |             }; | ||||||
|  | 
 | ||||||
|  |             // Check if the learning object has questions | ||||||
|  |             const questions = useQuestionsQuery(nodeLoId).data.value?.questions as QuestionDTO[] || []; | ||||||
|  |             result.set(learningObject.key, questions.length > 0); | ||||||
|  |         }); | ||||||
|  | 
 | ||||||
|  |         return result; | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  | // Helper function to check if a learning object has questions | ||||||
|  | function hasQuestions(learningObjectKey: string): boolean { | ||||||
|  |     return learningObjectHasQuestions.value.get(learningObjectKey) ?? false; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| </script> | </script> | ||||||
|  | @ -273,7 +296,7 @@ | ||||||
|                                     ></v-icon> |                                     ></v-icon> | ||||||
|                                 </template>  |                                 </template>  | ||||||
|                                 <template v-slot:append> |                                 <template v-slot:append> | ||||||
|                                     <v-icon v-if="false" icon="mdi-help-circle-outline" color="red" /> |                                     <v-icon v-if="hasQuestions(node.key)" icon="mdi-help-circle-outline" color="red" /> | ||||||
|                                     <div>{{ node.estimatedTime }}'</div>  |                                     <div>{{ node.estimatedTime }}'</div>  | ||||||
|                                 </template> |                                 </template> | ||||||
|                             </v-list-item> |                             </v-list-item> | ||||||
|  |  | ||||||
		Reference in a new issue
	
	 Timo De Meyst
						Timo De Meyst