style: fix linting issues met Prettier

This commit is contained in:
Lint Action 2025-05-19 14:38:09 +00:00
parent 13e29d7d5f
commit 0862cb5c6b
4 changed files with 10 additions and 11 deletions

View file

@ -14,14 +14,14 @@ import { mapToSubmissionDTO, mapToSubmissionDTOId } from '../interfaces/submissi
import { fetchClass } from './classes.js';
import { QuestionDTO, QuestionId } from '@dwengo-1/common/interfaces/question';
import { SubmissionDTO, SubmissionDTOId } from '@dwengo-1/common/interfaces/submission';
import {EntityDTO, ForeignKeyConstraintViolationException} from '@mikro-orm/core';
import { EntityDTO, ForeignKeyConstraintViolationException } from '@mikro-orm/core';
import { putObject } from './service-helper.js';
import { fetchStudents } from './students.js';
import { ServerErrorException } from '../exceptions/server-error-exception.js';
import { BadRequestException } from '../exceptions/bad-request-exception.js';
import {getQuestionsAboutLearningObjectInAssignment} from "./questions";
import {LearningObjectIdentifier} from "../entities/content/learning-object-identifier";
import {ConflictException} from "../exceptions/conflict-exception";
import { getQuestionsAboutLearningObjectInAssignment } from './questions';
import { LearningObjectIdentifier } from '../entities/content/learning-object-identifier';
import { ConflictException } from '../exceptions/conflict-exception';
export async function fetchAssignment(classid: string, assignmentNumber: number): Promise<Assignment> {
const classRepository = getClassRepository();
@ -140,10 +140,9 @@ export async function deleteAssignment(classid: string, id: number): Promise<Ass
try {
await assignmentRepository.deleteByClassAndId(cls, id);
} catch (e: ForeignKeyConstraintViolationException) {
throw new ConflictException("Cannot delete assigment with questions or submissions")
throw new ConflictException('Cannot delete assigment with questions or submissions');
}
return mapToAssignmentDTO(assignment);
}

View file

@ -26,7 +26,7 @@ import { ClassJoinRequestDTO } from '@dwengo-1/common/interfaces/class-join-requ
import { ConflictException } from '../exceptions/conflict-exception.js';
import { Submission } from '../entities/assignments/submission.entity.js';
import { mapToUsername } from '../interfaces/user.js';
import {mapToAssignmentDTO, mapToAssignmentDTOId} from "../interfaces/assignment";
import { mapToAssignmentDTO, mapToAssignmentDTOId } from '../interfaces/assignment';
export async function getAllStudents(full: boolean): Promise<StudentDTO[] | string[]> {
const studentRepository = getStudentRepository();
@ -105,7 +105,7 @@ export async function getStudentAssignments(username: string, full: boolean): Pr
const groupRepository = getGroupRepository();
const groups = await groupRepository.findAllGroupsWithStudent(student);
const assignments = await Promise.all(groups.map( async group => await fetchAssignment(group.assignment.within.classId, group.assignment.id)));
const assignments = await Promise.all(groups.map(async (group) => await fetchAssignment(group.assignment.within.classId, group.assignment.id)));
if (full) {
return assignments.map(mapToAssignmentDTO);

View file

@ -13,7 +13,8 @@ import {
createStudentRequestHandler,
getStudentRequestsHandler,
deleteClassJoinRequestHandler,
getStudentRequestHandler, getStudentAssignmentsHandler,
getStudentRequestHandler,
getStudentAssignmentsHandler,
} from '../../src/controllers/students.js';
import { getDireStraits, getNoordkaap, getTheDoors, TEST_STUDENTS } from '../test_assets/users/students.testdata.js';
import { NotFoundException } from '../../src/exceptions/not-found-exception.js';
@ -163,7 +164,6 @@ describe('Student controllers', () => {
expect(result.assignments).to.have.length.greaterThan(0);
});
it('Student submissions', async () => {
const submission = getSubmission01();
req = { params: { username: submission.submitter.username }, query: { full: 'true' } };

View file

@ -109,7 +109,7 @@
},
onError: (e) => {
showSnackbar(t("failed") + ": " + e.response.data.error || e.message, "error");
}
},
},
);
}