fix: bug in populate groups van assignment
This commit is contained in:
parent
509db70c73
commit
d8a7a86da0
2 changed files with 4 additions and 1 deletions
|
@ -7,7 +7,7 @@ export class AssignmentRepository extends DwengoEntityRepository<Assignment> {
|
||||||
return this.findOne({ within: within, id: id }, { populate: ['groups', 'groups.members'] });
|
return this.findOne({ within: within, id: id }, { populate: ['groups', 'groups.members'] });
|
||||||
}
|
}
|
||||||
public async findByClassIdAndAssignmentId(withinClass: string, id: number): Promise<Assignment | null> {
|
public async findByClassIdAndAssignmentId(withinClass: string, id: number): Promise<Assignment | null> {
|
||||||
return this.findOne({ within: { classId: withinClass }, id: id });
|
return this.findOne({ within: { classId: withinClass }, id: id }, { populate: ['groups', 'groups.members'] });
|
||||||
}
|
}
|
||||||
public async findAllByResponsibleTeacher(teacherUsername: string): Promise<Assignment[]> {
|
public async findAllByResponsibleTeacher(teacherUsername: string): Promise<Assignment[]> {
|
||||||
return this.findAll({
|
return this.findAll({
|
||||||
|
@ -20,6 +20,7 @@ export class AssignmentRepository extends DwengoEntityRepository<Assignment> {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
populate: ['groups', 'groups.members']
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
public async findAllAssignmentsInClass(within: Class): Promise<Assignment[]> {
|
public async findAllAssignmentsInClass(within: Class): Promise<Assignment[]> {
|
||||||
|
|
|
@ -43,6 +43,8 @@ export async function getAllAssignments(classid: string, full: boolean): Promise
|
||||||
const assignmentRepository = getAssignmentRepository();
|
const assignmentRepository = getAssignmentRepository();
|
||||||
const assignments = await assignmentRepository.findAllAssignmentsInClass(cls);
|
const assignments = await assignmentRepository.findAllAssignmentsInClass(cls);
|
||||||
|
|
||||||
|
console.log(assignments);
|
||||||
|
|
||||||
if (full) {
|
if (full) {
|
||||||
return assignments.map(mapToAssignmentDTO);
|
return assignments.map(mapToAssignmentDTO);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue