From 11600b8be47da06db565f5482e76208326677cbf Mon Sep 17 00:00:00 2001 From: Lint Action Date: Mon, 21 Apr 2025 06:30:38 +0000 Subject: [PATCH] style: fix linting issues met Prettier --- .../assignments/DeadlineSelector.vue | 30 +- .../components/assignments/GroupSelector.vue | 80 +++--- frontend/src/queries/learning-paths.ts | 15 +- frontend/src/queries/students.ts | 7 +- frontend/src/router/index.ts | 4 +- frontend/src/utils/assignment-rules.ts | 32 ++- .../views/assignments/CreateAssignment.vue | 269 ++++++++++-------- .../views/assignments/SingleAssignment.vue | 92 +++--- .../views/assignments/StudentAssignment.vue | 145 +++++----- .../views/assignments/TeacherAssignment.vue | 191 +++++++------ .../src/views/assignments/UserAssignments.vue | 254 ++++++++--------- 11 files changed, 578 insertions(+), 541 deletions(-) diff --git a/frontend/src/components/assignments/DeadlineSelector.vue b/frontend/src/components/assignments/DeadlineSelector.vue index 7c78296f..decb2632 100644 --- a/frontend/src/components/assignments/DeadlineSelector.vue +++ b/frontend/src/components/assignments/DeadlineSelector.vue @@ -1,21 +1,21 @@ - + diff --git a/frontend/src/components/assignments/GroupSelector.vue b/frontend/src/components/assignments/GroupSelector.vue index 6022e4c8..d143868d 100644 --- a/frontend/src/components/assignments/GroupSelector.vue +++ b/frontend/src/components/assignments/GroupSelector.vue @@ -1,51 +1,49 @@ + function createGroup(): void { + if (selectedStudents.value.length) { + // Extract only usernames (student.value) + const usernames = selectedStudents.value.map((student) => student.value); + emit("groupCreated", usernames); + selectedStudents.value = []; // Reset selection after creating group + } + } + - + diff --git a/frontend/src/queries/learning-paths.ts b/frontend/src/queries/learning-paths.ts index 33402a62..1f088c9d 100644 --- a/frontend/src/queries/learning-paths.ts +++ b/frontend/src/queries/learning-paths.ts @@ -1,8 +1,8 @@ -import {type MaybeRefOrGetter, toValue} from "vue"; -import type {Language} from "@/data-objects/language.ts"; -import {useQuery, type UseQueryReturnType} from "@tanstack/vue-query"; -import {getLearningPathController} from "@/controllers/controllers"; -import type {LearningPath} from "@/data-objects/learning-paths/learning-path.ts"; +import { type MaybeRefOrGetter, toValue } from "vue"; +import type { Language } from "@/data-objects/language.ts"; +import { useQuery, type UseQueryReturnType } from "@tanstack/vue-query"; +import { getLearningPathController } from "@/controllers/controllers"; +import type { LearningPath } from "@/data-objects/learning-paths/learning-path.ts"; export const LEARNING_PATH_KEY = "learningPath"; const learningPathController = getLearningPathController(); @@ -47,7 +47,8 @@ export function useSearchLearningPathQuery( }); } -export function useGetAllLearningPaths(language: MaybeRefOrGetter +export function useGetAllLearningPaths( + language: MaybeRefOrGetter, ): UseQueryReturnType { return useQuery({ queryKey: [LEARNING_PATH_KEY, "getAllLearningPaths", language], @@ -55,6 +56,6 @@ export function useGetAllLearningPaths(language: MaybeRefOrGetter Boolean(toValue(language)) + enabled: () => Boolean(toValue(language)), }); } diff --git a/frontend/src/queries/students.ts b/frontend/src/queries/students.ts index 0f9866b0..da87d28b 100644 --- a/frontend/src/queries/students.ts +++ b/frontend/src/queries/students.ts @@ -1,9 +1,10 @@ -import {computed, type Ref, toValue} from "vue"; +import { computed, type Ref, toValue } from "vue"; import type { MaybeRefOrGetter } from "vue"; import { type QueryObserverResult, useMutation, - type UseMutationReturnType, useQueries, + type UseMutationReturnType, + useQueries, useQuery, useQueryClient, type UseQueryReturnType, @@ -72,7 +73,7 @@ export function useStudentQuery( } export function useStudentsByUsernamesQuery( - usernames: MaybeRefOrGetter + usernames: MaybeRefOrGetter, ): Ref[]> { const resolvedUsernames = toValue(usernames) ?? []; diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index 70109be7..a7038af4 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -73,7 +73,7 @@ const router = createRouter({ }, { path: "/assignment", - meta: {requiresAuth: true}, + meta: { requiresAuth: true }, children: [ { path: "create", @@ -85,7 +85,7 @@ const router = createRouter({ name: "SingleAssigment", component: SingleAssignment, }, - ] + ], }, { path: "/class/:id", diff --git a/frontend/src/utils/assignment-rules.ts b/frontend/src/utils/assignment-rules.ts index b26c6aba..b0d29cee 100644 --- a/frontend/src/utils/assignment-rules.ts +++ b/frontend/src/utils/assignment-rules.ts @@ -5,8 +5,10 @@ */ export const assignmentTitleRules = [ (value: string): string | boolean => { - if (value?.length >= 1) {return true;} // Title must not be empty - return 'Title cannot be empty.'; + if (value?.length >= 1) { + return true; + } // Title must not be empty + return "Title cannot be empty."; }, ]; @@ -18,9 +20,9 @@ export const assignmentTitleRules = [ export const learningPathRules = [ (value: { hruid: string; title: string }): string | boolean => { if (value && value.hruid) { - return true; // Valid if hruid is present + return true; // Valid if hruid is present } - return 'You must select a learning path.'; + return "You must select a learning path."; }, ]; @@ -31,8 +33,10 @@ export const learningPathRules = [ */ export const classRules = [ (value: string): string | boolean => { - if (value) {return true;} - return 'You must select at least one class.'; + if (value) { + return true; + } + return "You must select at least one class."; }, ]; @@ -43,14 +47,20 @@ export const classRules = [ */ export const deadlineRules = [ (value: string): string | boolean => { - if (!value) {return "You must set a deadline.";} + if (!value) { + return "You must set a deadline."; + } const selectedDateTime = new Date(value); const now = new Date(); - if (isNaN(selectedDateTime.getTime())) {return "Invalid date or time.";} + if (isNaN(selectedDateTime.getTime())) { + return "Invalid date or time."; + } - if (selectedDateTime <= now) {return "The deadline must be in the future.";} + if (selectedDateTime <= now) { + return "The deadline must be in the future."; + } return true; }, @@ -58,7 +68,9 @@ export const deadlineRules = [ export const descriptionRules = [ (value: string): string | boolean => { - if (!value || value.trim() === "") {return "Description cannot be empty.";} + if (!value || value.trim() === "") { + return "Description cannot be empty."; + } return true; }, ]; diff --git a/frontend/src/views/assignments/CreateAssignment.vue b/frontend/src/views/assignments/CreateAssignment.vue index 63335828..bc114392 100644 --- a/frontend/src/views/assignments/CreateAssignment.vue +++ b/frontend/src/views/assignments/CreateAssignment.vue @@ -1,101 +1,111 @@ - diff --git a/frontend/src/views/assignments/SingleAssignment.vue b/frontend/src/views/assignments/SingleAssignment.vue index 845b697a..3d9f7f0a 100644 --- a/frontend/src/views/assignments/SingleAssignment.vue +++ b/frontend/src/views/assignments/SingleAssignment.vue @@ -1,60 +1,58 @@ - - + diff --git a/frontend/src/views/assignments/StudentAssignment.vue b/frontend/src/views/assignments/StudentAssignment.vue index 00ee07cf..3bf9a367 100644 --- a/frontend/src/views/assignments/StudentAssignment.vue +++ b/frontend/src/views/assignments/StudentAssignment.vue @@ -1,58 +1,56 @@ - diff --git a/frontend/src/views/assignments/TeacherAssignment.vue b/frontend/src/views/assignments/TeacherAssignment.vue index 1b2ba890..429e908a 100644 --- a/frontend/src/views/assignments/TeacherAssignment.vue +++ b/frontend/src/views/assignments/TeacherAssignment.vue @@ -1,43 +1,43 @@ - - + - {{t("members")}} + {{ t("members") }} { :key="index" > - {{ - member.firstName + ' ' + member.lastName - }} + {{ member.firstName + " " + member.lastName }} - Close + Close @@ -216,11 +224,10 @@ async function deleteAssignment(num: number, clsId: string): Promise { - diff --git a/frontend/src/views/assignments/UserAssignments.vue b/frontend/src/views/assignments/UserAssignments.vue index 8559aaac..eef543f9 100644 --- a/frontend/src/views/assignments/UserAssignments.vue +++ b/frontend/src/views/assignments/UserAssignments.vue @@ -1,87 +1,85 @@ -