style: fix linting issues met ESLint
This commit is contained in:
parent
b5390258e3
commit
e78849f568
21 changed files with 64 additions and 116 deletions
|
@ -29,9 +29,7 @@ export async function getAllClasses(
|
|||
if (full) {
|
||||
return classes.map(mapToClassDTO);
|
||||
}
|
||||
return classes.map((cls) => {
|
||||
return cls.classId!;
|
||||
});
|
||||
return classes.map((cls) => cls.classId!);
|
||||
}
|
||||
|
||||
export async function createClass(classData: ClassDTO): Promise<Class | null> {
|
||||
|
@ -45,7 +43,7 @@ export async function createClass(classData: ClassDTO): Promise<Class | null> {
|
|||
const students = (await Promise.all(studentUsernames.map(id => studentRepository.findByUsername(id))))
|
||||
.filter(student => student != null);
|
||||
|
||||
//const cls = mapToClass(classData, teachers, students);
|
||||
//Const cls = mapToClass(classData, teachers, students);
|
||||
|
||||
const classRepository = getClassRepository();
|
||||
|
||||
|
@ -91,9 +89,7 @@ export async function getClassStudents(classId: string): Promise<StudentDTO[]> {
|
|||
|
||||
export async function getClassStudentsIds(classId: string): Promise<string[]> {
|
||||
const students: StudentDTO[] = await fetchClassStudents(classId);
|
||||
return students.map((student) => {
|
||||
return student.username;
|
||||
});
|
||||
return students.map((student) => student.username);
|
||||
}
|
||||
|
||||
export async function getClassTeacherInvitations(
|
||||
|
|
|
@ -85,23 +85,15 @@ async function fetchLearningObjects(
|
|||
const nodes: LearningObjectNode[] = learningPathResponse.data[0].nodes;
|
||||
|
||||
if (!full) {
|
||||
return nodes.map((node) => {
|
||||
return node.learningobject_hruid;
|
||||
});
|
||||
return nodes.map((node) => node.learningobject_hruid);
|
||||
}
|
||||
|
||||
return await Promise.all(
|
||||
nodes.map(async (node) => {
|
||||
return getLearningObjectById(
|
||||
nodes.map(async (node) => getLearningObjectById(
|
||||
node.learningobject_hruid,
|
||||
language
|
||||
);
|
||||
})
|
||||
).then((objects) => {
|
||||
return objects.filter((obj): obj is FilteredLearningObject => {
|
||||
return obj !== null;
|
||||
});
|
||||
});
|
||||
))
|
||||
).then((objects) => objects.filter((obj): obj is FilteredLearningObject => obj !== null));
|
||||
} catch (error) {
|
||||
console.error('❌ Error fetching learning objects:', error);
|
||||
return [];
|
||||
|
|
|
@ -45,7 +45,7 @@ export async function getQuestion(questionId: QuestionId): Promise<QuestionDTO |
|
|||
const question = await fetchQuestion(questionId);
|
||||
|
||||
if (!question)
|
||||
return null
|
||||
{return null}
|
||||
|
||||
return mapToQuestionDTO(question);
|
||||
}
|
||||
|
@ -55,17 +55,17 @@ export async function getAnswersByQuestion(questionId: QuestionId, full: boolean
|
|||
const question = await fetchQuestion(questionId);
|
||||
|
||||
if (!question)
|
||||
return [];
|
||||
{return [];}
|
||||
|
||||
const answers: Answer[] = await answerRepository.findAllAnswersToQuestion(question);
|
||||
|
||||
if (!answers)
|
||||
return []
|
||||
{return []}
|
||||
|
||||
const answersDTO = answers.map(mapToAnswerDTO);
|
||||
|
||||
if (full)
|
||||
return answersDTO
|
||||
{return answersDTO}
|
||||
|
||||
return answersDTO.map(mapToAnswerId);
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ export async function deleteQuestion(questionId: QuestionId) {
|
|||
const question = await fetchQuestion(questionId);
|
||||
|
||||
if (!question)
|
||||
return null
|
||||
{return null}
|
||||
|
||||
try {
|
||||
await questionRepository.removeQuestionByLearningObjectAndSequenceNumber(
|
||||
|
|
|
@ -23,9 +23,7 @@ export async function getAllStudents(): Promise<StudentDTO[]> {
|
|||
|
||||
export async function getAllStudentIds(): Promise<string[]> {
|
||||
const users = await getAllStudents();
|
||||
return users.map((user) => {
|
||||
return user.username;
|
||||
});
|
||||
return users.map((user) => user.username);
|
||||
}
|
||||
|
||||
export async function getStudent(username: string): Promise<StudentDTO | null> {
|
||||
|
@ -98,9 +96,7 @@ export async function getStudentAssignments(username: string, full: boolean): Pr
|
|||
|
||||
const assignments = (
|
||||
await Promise.all(
|
||||
classes.map(async (cls) => {
|
||||
return await getAllAssignments(cls.classId!, full);
|
||||
})
|
||||
classes.map(async (cls) => await getAllAssignments(cls.classId!, full))
|
||||
)
|
||||
).flat();
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ export async function deleteSubmission(
|
|||
const submission = getSubmission(learningObjectHruid, language, version, submissionNumber);
|
||||
|
||||
if (!submission)
|
||||
return null
|
||||
{return null}
|
||||
|
||||
const loId = new LearningObjectIdentifier(learningObjectHruid, language, version);
|
||||
await submissionRepository.deleteSubmissionByLearningObjectAndSubmissionNumber(loId, submissionNumber);
|
||||
|
|
|
@ -27,9 +27,7 @@ export async function getAllTeachers(): Promise<TeacherDTO[]> {
|
|||
|
||||
export async function getAllTeacherIds(): Promise<string[]> {
|
||||
const users = await getAllTeachers();
|
||||
return users.map((user) => {
|
||||
return user.username;
|
||||
});
|
||||
return users.map((user) => user.username);
|
||||
}
|
||||
|
||||
export async function getTeacher(username: string): Promise<TeacherDTO | null> {
|
||||
|
@ -89,9 +87,7 @@ export async function getClassesByTeacher(username: string): Promise<ClassDTO[]>
|
|||
|
||||
export async function getClassIdsByTeacher(username: string): Promise<string[]> {
|
||||
const classes = await fetchClassesByTeacher(username);
|
||||
return classes.map((cls) => {
|
||||
return cls.id;
|
||||
});
|
||||
return classes.map((cls) => cls.id);
|
||||
}
|
||||
|
||||
export async function fetchStudentsByTeacher(username: string) {
|
||||
|
@ -99,9 +95,7 @@ export async function fetchStudentsByTeacher(username: string) {
|
|||
|
||||
return (
|
||||
await Promise.all(
|
||||
classes.map(async (id) => {
|
||||
return getClassStudents(id);
|
||||
})
|
||||
classes.map(async (id) => getClassStudents(id))
|
||||
)
|
||||
).flat();
|
||||
}
|
||||
|
@ -112,9 +106,7 @@ export async function getStudentsByTeacher(username: string): Promise<StudentDTO
|
|||
|
||||
export async function getStudentIdsByTeacher(username: string): Promise<string[]> {
|
||||
const students = await fetchStudentsByTeacher(username);
|
||||
return students.map((student) => {
|
||||
return student.username;
|
||||
});
|
||||
return students.map((student) => student.username);
|
||||
}
|
||||
|
||||
export async function fetchTeacherQuestions(username: string): Promise<QuestionDTO[]> {
|
||||
|
|
|
@ -16,9 +16,7 @@ export class UserService<T extends User> {
|
|||
|
||||
async getAllUserIds(): Promise<string[]> {
|
||||
const users = await this.getAllUsers();
|
||||
return users.map((user) => {
|
||||
return user.username;
|
||||
});
|
||||
return users.map((user) => user.username);
|
||||
}
|
||||
|
||||
async getUserByUsername(username: string): Promise<UserDTO | null> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue