feat(frontend): linter errors fixen
This commit is contained in:
		
							parent
							
								
									c68f0872bf
								
							
						
					
					
						commit
						5bb75ebdf8
					
				
					 3 changed files with 11 additions and 13 deletions
				
			
		|  | @ -1,7 +1,7 @@ | ||||||
| <script setup lang="ts"> | <script setup lang="ts"> | ||||||
| 
 | 
 | ||||||
| import auth from "@/services/auth/auth-service.ts"; | import auth from "@/services/auth/auth-service.ts"; | ||||||
| import {computed, reactive, type Ref, ref, watchEffect} from "vue"; | import {computed, type Ref, ref, watchEffect} from "vue"; | ||||||
| import StudentAssignment from "@/views/assignments/StudentAssignment.vue"; | import StudentAssignment from "@/views/assignments/StudentAssignment.vue"; | ||||||
| import TeacherAssignment from "@/views/assignments/TeacherAssignment.vue"; | import TeacherAssignment from "@/views/assignments/TeacherAssignment.vue"; | ||||||
| import {useRoute} from "vue-router"; | import {useRoute} from "vue-router"; | ||||||
|  | @ -21,14 +21,12 @@ function useGroupsWithProgress( | ||||||
|     groups: Ref<GroupDTO[]>, |     groups: Ref<GroupDTO[]>, | ||||||
|     hruid: Ref<string>, |     hruid: Ref<string>, | ||||||
|     language: Ref<string> |     language: Ref<string> | ||||||
| ): { groupProgressMap: Record<number, number> } { | ): { groupProgressMap: Map<number, number> } { | ||||||
|     const groupProgressMap: Record<number, number> = reactive({}); |     const groupProgressMap: Map<number, number> = new Map<number, number>(); | ||||||
| 
 | 
 | ||||||
|     watchEffect(() => { |     watchEffect(() => { | ||||||
|         // Clear existing entries to avoid stale data |         // Clear existing entries to avoid stale data | ||||||
|         for (const key in groupProgressMap) { |         groupProgressMap.clear(); | ||||||
|             delete groupProgressMap[key]; |  | ||||||
|         } |  | ||||||
| 
 | 
 | ||||||
|         const lang = ref(language.value as Language); |         const lang = ref(language.value as Language); | ||||||
| 
 | 
 | ||||||
|  | @ -44,7 +42,7 @@ function useGroupsWithProgress( | ||||||
| 
 | 
 | ||||||
|             const data = query.data.value; |             const data = query.data.value; | ||||||
| 
 | 
 | ||||||
|             groupProgressMap[groupKey] = data ? calculateProgress(data) : 0; |             groupProgressMap.set(groupKey, data ? calculateProgress(data) : 0); | ||||||
|         }); |         }); | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -19,7 +19,7 @@ const props = defineProps<{ | ||||||
|         groups: Ref<GroupDTO[]>, |         groups: Ref<GroupDTO[]>, | ||||||
|         hruid: Ref<string>, |         hruid: Ref<string>, | ||||||
|         language: Ref<Language> |         language: Ref<Language> | ||||||
|     ) => { groupProgressMap: Record<string, number> }; |     ) => { groupProgressMap: Map<number, number> }; | ||||||
| }>(); | }>(); | ||||||
| 
 | 
 | ||||||
| const {t, locale} = useI18n(); | const {t, locale} = useI18n(); | ||||||
|  | @ -50,7 +50,7 @@ const group = computed(() => | ||||||
| ); | ); | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| const groupArray = computed(() => (group.value ? [group.value] : [])); | const _groupArray = computed(() => (group.value ? [group.value] : [])); | ||||||
| const progressValue = ref(0); | const progressValue = ref(0); | ||||||
| /* Crashes right now cause api data has inexistent hruid TODO: uncomment later and use it in progress bar | /* Crashes right now cause api data has inexistent hruid TODO: uncomment later and use it in progress bar | ||||||
| Const {groupProgressMap} = props.useGroupsWithProgress( | Const {groupProgressMap} = props.useGroupsWithProgress( | ||||||
|  |  | ||||||
|  | @ -17,7 +17,7 @@ const props = defineProps<{ | ||||||
|         groups: Ref<GroupDTO[]>, |         groups: Ref<GroupDTO[]>, | ||||||
|         hruid: Ref<string>, |         hruid: Ref<string>, | ||||||
|         language: Ref<Language> |         language: Ref<Language> | ||||||
|     ) => { groupProgressMap: Record<string, number> }; |     ) => { groupProgressMap: Map<number, number> }; | ||||||
| }>(); | }>(); | ||||||
| 
 | 
 | ||||||
| const {t, locale} = useI18n(); | const {t, locale} = useI18n(); | ||||||
|  | @ -143,13 +143,13 @@ async function deleteAssignment(num: number, clsId: string): Promise<void> { | ||||||
|                             item-key="id" |                             item-key="id" | ||||||
|                             class="elevation-1" |                             class="elevation-1" | ||||||
|                         > |                         > | ||||||
|                             <template v-slot:item.name="{ item }"> |                             <template #[`item.name`]="{ item }"> | ||||||
|                                 <v-btn @click="openGroupDetails(item)" variant="text" color="primary"> |                                 <v-btn @click="openGroupDetails(item)" variant="text" color="primary"> | ||||||
|                                     {{ item.name }} |                                     {{ item.name }} | ||||||
|                                 </v-btn> |                                 </v-btn> | ||||||
|                             </template> |                             </template> | ||||||
| 
 | 
 | ||||||
|                             <template v-slot:item.progress="{ item }"> |                             <template #[`item.progress`]="{ item }"> | ||||||
|                                 <v-progress-linear |                                 <v-progress-linear | ||||||
|                                     :model-value="item.progress" |                                     :model-value="item.progress" | ||||||
|                                     color="blue-grey" |                                     color="blue-grey" | ||||||
|  | @ -161,7 +161,7 @@ async function deleteAssignment(num: number, clsId: string): Promise<void> { | ||||||
|                                 </v-progress-linear> |                                 </v-progress-linear> | ||||||
|                             </template> |                             </template> | ||||||
| 
 | 
 | ||||||
|                             <template v-slot:item.submission="{ item }"> |                             <template #[`item.submission`]="{ item }"> | ||||||
|                                 <v-btn |                                 <v-btn | ||||||
|                                     :to="item.submitted ? `${props.assignmentId}/submissions/` : undefined" |                                     :to="item.submitted ? `${props.assignmentId}/submissions/` : undefined" | ||||||
|                                     :color="item.submitted ? 'green' : 'red'" |                                     :color="item.submitted ? 'green' : 'red'" | ||||||
|  |  | ||||||
		Reference in a new issue
	
	 Joyelle Ndagijimana
						Joyelle Ndagijimana