style: fix linting issues met Prettier
This commit is contained in:
parent
fc5a40ba40
commit
9b0c0c9889
11 changed files with 43 additions and 45 deletions
|
|
@ -3,7 +3,7 @@ import {
|
|||
getGroupRepository,
|
||||
getQuestionRepository,
|
||||
getStudentRepository,
|
||||
getSubmissionRepository
|
||||
getSubmissionRepository,
|
||||
} from '../data/repositories.js';
|
||||
import { AssignmentDTO } from '../interfaces/assignment.js';
|
||||
import { ClassDTO, mapToClassDTO } from '../interfaces/class.js';
|
||||
|
|
@ -11,7 +11,7 @@ import { GroupDTO, mapToGroupDTO, mapToGroupDTOId } from '../interfaces/group.js
|
|||
import { mapToStudent, mapToStudentDTO, StudentDTO } from '../interfaces/student.js';
|
||||
import { mapToSubmissionDTO, SubmissionDTO } from '../interfaces/submission.js';
|
||||
import { getAllAssignments } from './assignments.js';
|
||||
import {mapToQuestionDTO, mapToQuestionId, QuestionDTO, QuestionId} from "../interfaces/question";
|
||||
import { mapToQuestionDTO, mapToQuestionId, QuestionDTO, QuestionId } from '../interfaces/question';
|
||||
|
||||
export async function getAllStudents(): Promise<StudentDTO[]> {
|
||||
const studentRepository = getStudentRepository();
|
||||
|
|
@ -138,8 +138,9 @@ export async function getStudentQuestions(username: string, full: boolean): Prom
|
|||
const questionRepository = getQuestionRepository();
|
||||
const questions = await questionRepository.findAllByAuthor(student);
|
||||
|
||||
if (full)
|
||||
{return questions.map(mapToQuestionDTO)}
|
||||
if (full) {
|
||||
return questions.map(mapToQuestionDTO);
|
||||
}
|
||||
|
||||
return questions.map(mapToQuestionId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,8 +14,9 @@ export async function getAllTeachers(full: boolean): Promise<TeacherDTO[]> {
|
|||
const teacherRepository = getTeacherRepository();
|
||||
const users = await teacherRepository.findAll();
|
||||
|
||||
if (full)
|
||||
{return users.map(mapToTeacherDTO);}
|
||||
if (full) {
|
||||
return users.map(mapToTeacherDTO);
|
||||
}
|
||||
return users.map((user) => user.username);
|
||||
}
|
||||
|
||||
|
|
@ -73,17 +74,19 @@ async function fetchClassesByTeacher(username: string): Promise<ClassDTO[]> {
|
|||
export async function getClassesByTeacher(username: string, full: boolean): Promise<ClassDTO[] | string[]> {
|
||||
const classes = await fetchClassesByTeacher(username);
|
||||
|
||||
if (full)
|
||||
{return classes;}
|
||||
if (full) {
|
||||
return classes;
|
||||
}
|
||||
return classes.map((cls) => cls.id);
|
||||
}
|
||||
|
||||
export async function getStudentsByTeacher(username: string, full: boolean) {
|
||||
const classes = await getClassesByTeacher(username, false);
|
||||
|
||||
const students = (await Promise.all(classes.map(async (id) => getClassStudents(id)))).flat();
|
||||
if (full)
|
||||
{return students}
|
||||
const students = (await Promise.all(classes.map(async (id) => getClassStudents(id)))).flat();
|
||||
if (full) {
|
||||
return students;
|
||||
}
|
||||
return students.map((student) => student.username);
|
||||
}
|
||||
|
||||
|
|
@ -102,9 +105,9 @@ export async function getTeacherQuestions(username: string, full: boolean): Prom
|
|||
const questionRepository = getQuestionRepository();
|
||||
const questions = await questionRepository.findAllByLearningObjects(learningObjects);
|
||||
|
||||
if (full)
|
||||
{return questions.map(mapToQuestionDTO);}
|
||||
if (full) {
|
||||
return questions.map(mapToQuestionDTO);
|
||||
}
|
||||
|
||||
return questions.map(mapToQuestionId);
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in a new issue