From 6ad7fbf208db68bfc3f4a6b8d7a41c31e5b96b5b Mon Sep 17 00:00:00 2001 From: Tibo De Peuter Date: Sat, 22 Mar 2025 18:50:22 +0100 Subject: [PATCH] refactor(backend): equality --- backend/src/services/class.ts | 4 ++-- backend/src/services/groups.ts | 2 +- backend/tests/data/questions/answers.test.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/src/services/class.ts b/backend/src/services/class.ts index 4f3cbc9d..52d841f4 100644 --- a/backend/src/services/class.ts +++ b/backend/src/services/class.ts @@ -25,13 +25,13 @@ export async function createClass(classData: ClassDTO): Promise { const teacherRepository = getTeacherRepository(); const teacherUsernames = classData.teachers || []; const teachers = (await Promise.all(teacherUsernames.map(async (id) => teacherRepository.findByUsername(id)))).filter( - (teacher) => teacher != null + (teacher) => teacher !== null ); const studentRepository = getStudentRepository(); const studentUsernames = classData.students || []; const students = (await Promise.all(studentUsernames.map(async (id) => studentRepository.findByUsername(id)))).filter( - (student) => student != null + (student) => student !== null ); //Const cls = mapToClass(classData, teachers, students); diff --git a/backend/src/services/groups.ts b/backend/src/services/groups.ts index 6abcd3fc..30be8b86 100644 --- a/backend/src/services/groups.ts +++ b/backend/src/services/groups.ts @@ -44,7 +44,7 @@ export async function createGroup(groupData: GroupDTO, classid: string, assignme const memberUsernames = (groupData.members as string[]) || []; // TODO check if groupdata.members is a list const members = (await Promise.all([...memberUsernames].map(async (id) => studentRepository.findByUsername(id)))).filter( - (student) => student != null + (student) => student !== null ); getLogger().debug(members); diff --git a/backend/tests/data/questions/answers.test.ts b/backend/tests/data/questions/answers.test.ts index bcc62cf6..e53f1b5f 100644 --- a/backend/tests/data/questions/answers.test.ts +++ b/backend/tests/data/questions/answers.test.ts @@ -23,7 +23,7 @@ describe('AnswerRepository', () => { const id = new LearningObjectIdentifier('id05', Language.English, 1); const questions = await questionRepository.findAllQuestionsAboutLearningObject(id); - const question = questions.filter((it) => it.sequenceNumber == 2)[0]; + const question = questions.filter((it) => it.sequenceNumber === 2)[0]; const answers = await answerRepository.findAllAnswersToQuestion(question);