feat(backend): Submissions kunnen nu per leerobject, assignment en optioneel groepslid opgevraagd worden

This commit is contained in:
Gerald Schmittinger 2025-04-07 21:48:28 +02:00
parent 9135b9c5b0
commit 64fd66a1de
4 changed files with 94 additions and 47 deletions

View file

@ -51,26 +51,32 @@ export class SubmissionRepository extends DwengoEntityRepository<Submission> {
);
}
public async findAllSubmissionsForAllGroupsOfStudent(studentUsername: string): Promise<Submission[]> {
return this.findAll({
where: {
onBehalfOf: {
members: {
$some: {
username: studentUsername
}
},
/**
* Looks up all submissions for the given learning object which were submitted as part of the given assignment.
* When forStudentUsername is set, only the submissions of the given user's group are shown.
*/
public async findAllSubmissionsForLearningObjectAndAssignment(
loId: LearningObjectIdentifier,
assignment: Assignment,
forStudentUsername?: string
): Promise<Submission[]> {
let onBehalfOf = forStudentUsername ? {
assignment,
members: {
$some: {
username: forStudentUsername
}
}
});
}
} : {
assignment
};
public async findAllSubmissionsForAssignment(assignment: Assignment): Promise<Submission[]> {
return this.findAll({
where: {
onBehalfOf: {
assignment
}
learningObjectHruid: loId.hruid,
learningObjectLanguage: loId.language,
learningObjectVersion: loId.version,
onBehalfOf
}
});
}