fix: Test- en linting-errors opgelost

This commit is contained in:
Gerald Schmittinger 2025-04-18 23:47:56 +02:00
parent ce5c0ea629
commit ba912c3ef0
20 changed files with 103 additions and 116 deletions

View file

@ -61,28 +61,36 @@ export class SubmissionRepository extends DwengoEntityRepository<Submission> {
/**
* Looks up all submissions for the given learning object which were submitted as part of the given assignment.
* When forGroup is set, only the submissions of the given group are shown.
*/
public async findAllSubmissionsForLearningObjectAndAssignment(
loId: LearningObjectIdentifier,
assignment: Assignment,
forGroup?: number
): Promise<Submission[]> {
const onBehalfOf = forGroup
? {
assignment,
groupNumber: forGroup
}
: {
assignment,
};
return this.findAll({
where: {
learningObjectHruid: loId.hruid,
learningObjectLanguage: loId.language,
learningObjectVersion: loId.version,
onBehalfOf,
onBehalfOf: {
assignment
}
},
});
}
/**
* Looks up all submissions for the given learning object which were submitted by the given group
*/
public async findAllSubmissionsForLearningObjectAndGroup(
loId: LearningObjectIdentifier,
group: Group,
): Promise<Submission[]> {
return this.findAll({
where: {
learningObjectHruid: loId.hruid,
learningObjectLanguage: loId.language,
learningObjectVersion: loId.version,
onBehalfOf: group
},
});
}

View file

@ -29,13 +29,13 @@ export class LearningPathRepository extends DwengoEntityRepository<LearningPath>
}
public createNode(
nodeData: RequiredEntityData<LearningPathNode, never, false>
nodeData: RequiredEntityData<LearningPathNode>
): LearningPathNode {
return this.em.create(LearningPathNode, nodeData);
}
public createTransition(
transitionData: RequiredEntityData<LearningPathTransition, never, false>
transitionData: RequiredEntityData<LearningPathTransition>
): LearningPathTransition {
return this.em.create(LearningPathTransition, transitionData)
}
@ -53,7 +53,7 @@ export class LearningPathRepository extends DwengoEntityRepository<LearningPath>
}
const em = this.getEntityManager();
await em.persistAndFlush(path);
await Promise.all(nodes.map(it => em.persistAndFlush(it)));
await Promise.all(transitions.map(it => em.persistAndFlush(it)));
await Promise.all(nodes.map(async it => em.persistAndFlush(it)));
await Promise.all(transitions.map(async it => em.persistAndFlush(it)));
}
}