From 323d66bbcbe66fe0e4cc32809edecc1fb55811d7 Mon Sep 17 00:00:00 2001 From: Lint Action Date: Sat, 17 May 2025 18:47:26 +0000 Subject: [PATCH] style: fix linting issues met Prettier --- backend/src/controllers/assignments.ts | 4 +- .../data/assignments/assignment-repository.ts | 2 +- backend/src/routes/teachers.ts | 1 - backend/src/services/assignments.ts | 20 +- backend/src/services/teachers.ts | 7 +- .../src/components/GroupSubmissionStatus.vue | 4 +- .../assignments/DeadlineSelector.vue | 4 +- .../components/assignments/GroupSelector.vue | 856 +++++++++--------- frontend/src/utils/assignment-rules.ts | 3 - .../views/assignments/CreateAssignment.vue | 310 ++++--- .../views/assignments/StudentAssignment.vue | 4 +- .../views/assignments/TeacherAssignment.vue | 591 ++++++------ 12 files changed, 908 insertions(+), 898 deletions(-) diff --git a/backend/src/controllers/assignments.ts b/backend/src/controllers/assignments.ts index bd2c7244..4bc7611d 100644 --- a/backend/src/controllers/assignments.ts +++ b/backend/src/controllers/assignments.ts @@ -39,9 +39,9 @@ export async function getAllAssignmentsHandler(req: Request, res: Response): Pro export async function createAssignmentHandler(req: Request, res: Response): Promise { const classid = req.params.classid; - const description = req.body.description || ""; + const description = req.body.description || ''; const language = req.body.language || FALLBACK_LANG; - const learningPath = req.body.learningPath || ""; + const learningPath = req.body.learningPath || ''; const title = req.body.title; requireFields({ title }); diff --git a/backend/src/data/assignments/assignment-repository.ts b/backend/src/data/assignments/assignment-repository.ts index 9d04d6e2..2ca13545 100644 --- a/backend/src/data/assignments/assignment-repository.ts +++ b/backend/src/data/assignments/assignment-repository.ts @@ -20,7 +20,7 @@ export class AssignmentRepository extends DwengoEntityRepository { }, }, }, - populate: ['groups', 'groups.members'] + populate: ['groups', 'groups.members'], }); } public async findAllAssignmentsInClass(within: Class): Promise { diff --git a/backend/src/routes/teachers.ts b/backend/src/routes/teachers.ts index e7179b3d..c7280f02 100644 --- a/backend/src/routes/teachers.ts +++ b/backend/src/routes/teachers.ts @@ -31,7 +31,6 @@ router.get('/:username/students', preventImpersonation, getTeacherStudentHandler router.get(`/:username/assignments`, getTeacherAssignmentsHandler); - router.get('/:username/joinRequests/:classId', onlyAllowTeacherOfClass, getStudentJoinRequestHandler); router.put('/:username/joinRequests/:classId/:studentUsername', onlyAllowTeacherOfClass, updateStudentJoinRequestHandler); diff --git a/backend/src/services/assignments.ts b/backend/src/services/assignments.ts index 28017eb0..3136099e 100644 --- a/backend/src/services/assignments.ts +++ b/backend/src/services/assignments.ts @@ -103,20 +103,22 @@ export async function putAssignment(classid: string, id: number, assignmentData: if (assignmentData.groups) { const hasDuplicates = (arr: string[]) => new Set(arr).size !== arr.length; if (hasDuplicates(assignmentData.groups.flat() as string[])) { - throw new BadRequestException("Student can only be in one group"); + throw new BadRequestException('Student can only be in one group'); } - const studentLists = await Promise.all((assignmentData.groups as string[][]).map(async group => await fetchStudents(group))); + const studentLists = await Promise.all((assignmentData.groups as string[][]).map(async (group) => await fetchStudents(group))); const groupRepository = getGroupRepository(); await groupRepository.deleteAllByAssignment(assignment); - await Promise.all(studentLists.map(async students => { - const newGroup = groupRepository.create({ - assignment: assignment, - members: students, - }); - await groupRepository.save(newGroup); - })); + await Promise.all( + studentLists.map(async (students) => { + const newGroup = groupRepository.create({ + assignment: assignment, + members: students, + }); + await groupRepository.save(newGroup); + }) + ); delete assignmentData.groups; } diff --git a/backend/src/services/teachers.ts b/backend/src/services/teachers.ts index ecd12a4a..4d65231d 100644 --- a/backend/src/services/teachers.ts +++ b/backend/src/services/teachers.ts @@ -1,9 +1,4 @@ -import { - getAssignmentRepository, - getClassJoinRequestRepository, - getClassRepository, - getTeacherRepository, -} from '../data/repositories.js'; +import { getAssignmentRepository, getClassJoinRequestRepository, getClassRepository, getTeacherRepository } from '../data/repositories.js'; import { mapToClassDTO } from '../interfaces/class.js'; import { mapToTeacher, mapToTeacherDTO } from '../interfaces/teacher.js'; import { Teacher } from '../entities/users/teacher.entity.js'; diff --git a/frontend/src/components/GroupSubmissionStatus.vue b/frontend/src/components/GroupSubmissionStatus.vue index ca3de9a3..0e4a0f6c 100644 --- a/frontend/src/components/GroupSubmissionStatus.vue +++ b/frontend/src/components/GroupSubmissionStatus.vue @@ -3,7 +3,7 @@ import UsingQueryResult from "@/components/UsingQueryResult.vue"; import { useAssignmentSubmissionsQuery } from "@/queries/assignments.ts"; import type { SubmissionsResponse } from "@/controllers/submissions.ts"; - import {watch} from "vue"; + import { watch } from "vue"; const props = defineProps<{ group: object; @@ -29,7 +29,7 @@ emit("update:hasSubmission", data.submissions.length > 0); } }, - { immediate: true } + { immediate: true }, ); diff --git a/frontend/src/components/assignments/DeadlineSelector.vue b/frontend/src/components/assignments/DeadlineSelector.vue index 845a1a5a..b9b0c709 100644 --- a/frontend/src/components/assignments/DeadlineSelector.vue +++ b/frontend/src/components/assignments/DeadlineSelector.vue @@ -6,8 +6,7 @@ const datetime = ref(""); - datetime.value = props.deadline ? new Date(props.deadline).toISOString().slice(0, 16) : "" - + datetime.value = props.deadline ? new Date(props.deadline).toISOString().slice(0, 16) : ""; // Watch the datetime value and emit the update watch(datetime, (val) => { @@ -21,7 +20,6 @@ const deadlineRules = [ (value: string): string | boolean => { - const selectedDateTime = new Date(value); const now = new Date(); diff --git a/frontend/src/components/assignments/GroupSelector.vue b/frontend/src/components/assignments/GroupSelector.vue index 6e6426fa..90b86e2a 100644 --- a/frontend/src/components/assignments/GroupSelector.vue +++ b/frontend/src/components/assignments/GroupSelector.vue @@ -1,281 +1,135 @@