refactor(backend): equality
This commit is contained in:
parent
10d3d0567e
commit
6ad7fbf208
3 changed files with 4 additions and 4 deletions
|
@ -25,13 +25,13 @@ export async function createClass(classData: ClassDTO): Promise<Class | null> {
|
|||
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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue