fix(backend): Fouten resulterend uit refactoring opgelost.
This commit is contained in:
		
							parent
							
								
									8c096ffa15
								
							
						
					
					
						commit
						f4fda7db5d
					
				
					 3 changed files with 5 additions and 4 deletions
				
			
		|  | @ -5,6 +5,7 @@ import { Student } from '../../entities/users/student.entity.js'; | ||||||
| import { LearningObject } from '../../entities/content/learning-object.entity.js'; | import { LearningObject } from '../../entities/content/learning-object.entity.js'; | ||||||
| import { Assignment } from '../../entities/assignments/assignment.entity.js'; | import { Assignment } from '../../entities/assignments/assignment.entity.js'; | ||||||
| import { Loaded } from '@mikro-orm/core'; | import { Loaded } from '@mikro-orm/core'; | ||||||
|  | import {Group} from "../../entities/assignments/group.entity"; | ||||||
| 
 | 
 | ||||||
| export class QuestionRepository extends DwengoEntityRepository<Question> { | export class QuestionRepository extends DwengoEntityRepository<Question> { | ||||||
|     public async createQuestion(question: { loId: LearningObjectIdentifier; author: Student; content: string }): Promise<Question> { |     public async createQuestion(question: { loId: LearningObjectIdentifier; author: Student; content: string }): Promise<Question> { | ||||||
|  | @ -59,7 +60,7 @@ export class QuestionRepository extends DwengoEntityRepository<Question> { | ||||||
| 
 | 
 | ||||||
|     public async findAllByAssignment(assignment: Assignment): Promise<Question[]> { |     public async findAllByAssignment(assignment: Assignment): Promise<Question[]> { | ||||||
|         return this.find({ |         return this.find({ | ||||||
|             author: assignment.groups.flatMap((group) => group.members), |             author: assignment.groups.toArray<Group>().flatMap((group) => group.members), | ||||||
|             learningObjectHruid: assignment.learningPathHruid, |             learningObjectHruid: assignment.learningPathHruid, | ||||||
|             learningObjectLanguage: assignment.learningPathLanguage, |             learningObjectLanguage: assignment.learningPathLanguage, | ||||||
|         }); |         }); | ||||||
|  |  | ||||||
|  | @ -17,7 +17,7 @@ export function mapToSubmissionDTO(submission: Submission): SubmissionDTO { | ||||||
|         submissionNumber: submission.submissionNumber, |         submissionNumber: submission.submissionNumber, | ||||||
|         submitter: mapToStudentDTO(submission.submitter), |         submitter: mapToStudentDTO(submission.submitter), | ||||||
|         time: submission.submissionTime, |         time: submission.submissionTime, | ||||||
|         group: submission.onBehalfOf ? mapToGroupDTO(submission.onBehalfOf) : undefined, |         group: submission.onBehalfOf ? mapToGroupDTO(submission.onBehalfOf, submission.onBehalfOf.assignment.within) : undefined, | ||||||
|         content: submission.content, |         content: submission.content, | ||||||
|     }; |     }; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -98,10 +98,10 @@ export async function getStudentGroups(username: string, full: boolean): Promise | ||||||
|     const groups = await groupRepository.findAllGroupsWithStudent(student); |     const groups = await groupRepository.findAllGroupsWithStudent(student); | ||||||
| 
 | 
 | ||||||
|     if (full) { |     if (full) { | ||||||
|         return groups.map(mapToGroupDTO); |         return groups.map(group => mapToGroupDTO(group, group.assignment.within)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     return groups.map(mapToGroupDTOId); |     return groups.map(group => mapToGroupDTOId(group, group.assignment.within)); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export async function getStudentSubmissions(username: string, full: boolean): Promise<SubmissionDTO[] | SubmissionDTOId[]> { | export async function getStudentSubmissions(username: string, full: boolean): Promise<SubmissionDTO[] | SubmissionDTOId[]> { | ||||||
|  |  | ||||||
		Reference in a new issue
	
	 Gerald Schmittinger
						Gerald Schmittinger