refactor: Linting
This commit is contained in:
		
							parent
							
								
									18e17e0133
								
							
						
					
					
						commit
						9393898e06
					
				
					 5 changed files with 27 additions and 30 deletions
				
			
		|  | @ -90,7 +90,8 @@ export async function createQuestion(loId: LearningObjectIdentifier, questionDat | |||
|     let assignment; | ||||
| 
 | ||||
|     if (typeof questionData.inGroup.assignment === 'number' && typeof questionData.inGroup.class === 'string') { | ||||
|         assignment = await fetchAssignment(questionData.inGroup.class, questionData.inGroup.assignment); | ||||
|         assignment = await fetchAssignment(questionData.inGroup.class, | ||||
|             questionData.inGroup.assignment); | ||||
|     } else { | ||||
|         // TODO check if necessary and no conflicts to delete this if
 | ||||
|         const clazz = await getClassRepository().findById((questionData.inGroup.assignment as AssignmentDTO).within); | ||||
|  |  | |||
|  | @ -2,7 +2,6 @@ import { EntityManager } from '@mikro-orm/core'; | |||
| import { Answer } from '../../../src/entities/questions/answer.entity'; | ||||
| import { Teacher } from '../../../src/entities/users/teacher.entity'; | ||||
| import { Question } from '../../../src/entities/questions/question.entity'; | ||||
| import { getTestleerling1 } from '../users/students.testdata'; | ||||
| import { getTestleerkracht1 } from '../users/teachers.testdata'; | ||||
| import { getQuestion07 } from './questions.testdata'; | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,24 +1,21 @@ | |||
| <script setup lang="ts"> | ||||
|     import type { LearningObject } from "@/data-objects/learning-objects/learning-object"; | ||||
|     import { useQuestionsQuery } from "@/queries/questions"; | ||||
|     import type { LearningObjectIdentifierDTO } from "@dwengo-1/common/interfaces/learning-content"; | ||||
|     import { languageMap } from "@dwengo-1/common/util/language"; | ||||
|     import { computed, ref } from "vue"; | ||||
| import type { LearningObject } from "@/data-objects/learning-objects/learning-object"; | ||||
| import { useQuestionsQuery } from "@/queries/questions"; | ||||
| import type { LearningObjectIdentifierDTO } from "@dwengo-1/common/interfaces/learning-content"; | ||||
| import { computed } from 'vue'; | ||||
| 
 | ||||
|     const props = defineProps<{ | ||||
| const props = defineProps<{ | ||||
|         node: LearningObject; | ||||
|     }>(); | ||||
| 
 | ||||
|     const loid = { | ||||
|         hruid: props.node.key, | ||||
|         version: props.node.version, | ||||
|         language: props.node.language, | ||||
|     } as LearningObjectIdentifierDTO; | ||||
|     const { data, isLoading, error } = useQuestionsQuery(loid); | ||||
|         language: props.node.language,} as LearningObjectIdentifierDTO; | ||||
| const { data  } = useQuestionsQuery(loid); | ||||
| 
 | ||||
|     const hasQuestions = computed(() => (data.value?.questions.length ?? 0) > 0); | ||||
| 
 | ||||
|     const hasQuestions = computed(() => { | ||||
|         return (data.value?.questions.length ?? 0) > 0; | ||||
|     }); | ||||
| </script> | ||||
| <template v-if="!isLoading & !error"> | ||||
|     <v-icon | ||||
|  |  | |||
|  | @ -13,13 +13,13 @@ | |||
| 
 | ||||
|     const expanded = ref(false); | ||||
| 
 | ||||
|     const toggle = () => { | ||||
|     function toggle (): void { | ||||
|         expanded.value = !expanded.value; | ||||
|     }; | ||||
|     } | ||||
| 
 | ||||
|     const formatDate = (timestamp: string | Date): string => { | ||||
|     function formatDate (timestamp: string | Date): string { | ||||
|         return new Date(timestamp).toLocaleString(); | ||||
|     }; | ||||
|     } | ||||
| 
 | ||||
|     const answersQuery = useAnswersQuery( | ||||
|         computed( | ||||
|  | @ -39,16 +39,16 @@ | |||
| 
 | ||||
|     const answer = ref(""); | ||||
| 
 | ||||
|     function submitAnswer() { | ||||
|     function submitAnswer(): void { | ||||
|         const answerData: AnswerData = { | ||||
|             author: authService.authState.user?.profile.preferred_username as string, | ||||
|             content: answer.value, | ||||
|         }; | ||||
|         if (answer.value != "") { | ||||
|         if (answer.value !== "") { | ||||
|             createAnswerMutation.mutate(answerData, { | ||||
|                 onSuccess: () => { | ||||
|                 onSuccess: async () => { | ||||
|                     answer.value = ""; | ||||
|                     answersQuery.refetch(); | ||||
|                     await answersQuery.refetch(); | ||||
|                 }, | ||||
|             }); | ||||
|         } else { | ||||
|  |  | |||
|  | @ -165,7 +165,7 @@ | |||
| 
 | ||||
|     const questionInput = ref(""); | ||||
| 
 | ||||
|     function submitQuestion() { | ||||
|     function submitQuestion(): void { | ||||
|         const assignments = studentAssignmentsQueryResult.data.value?.assignments as AssignmentDTO[]; | ||||
|         const assignment = assignments.find( | ||||
|             (assignment) => assignment.learningPath === props.hruid && assignment.language === props.language, | ||||
|  | @ -176,16 +176,16 @@ | |||
|             author: authService.authState.user?.profile.preferred_username, | ||||
|             content: questionInput.value, | ||||
|             inGroup: group, //TODO: POST response zegt dat dit null is??? | ||||
|         }; | ||||
|         console.log(questionData); | ||||
|         if (questionInput.value != "") { | ||||
|         } | ||||
|         if (questionInput.value !== "") { | ||||
|             createQuestionMutation.mutate(questionData, { | ||||
|                 onSuccess: () => { | ||||
|                 onSuccess: async () => { | ||||
|                     questionInput.value = ""; // Clear the input field after submission | ||||
|                     getQuestionsQuery.refetch(); // Reload the questions | ||||
|                     await getQuestionsQuery.refetch(); // Reload the questions | ||||
|                 }, | ||||
|                 onError: (e) => { | ||||
|                     console.error(e); | ||||
|                 onError: (_) => { | ||||
|                     // TODO Handle error | ||||
|                     // - console.error(e); | ||||
|                 }, | ||||
|             }); | ||||
|         } else { | ||||
|  |  | |||
		Reference in a new issue