Merge pull request #186 from SELab-2/bug/seed-file-crasht
fix seed file
This commit is contained in:
		
						commit
						a91e4b2a73
					
				
					 1 changed files with 5 additions and 3 deletions
				
			
		|  | @ -14,6 +14,8 @@ import { makeTestQuestions } from '../tests/test_assets/questions/questions.test | ||||||
| import { makeTestStudents } from '../tests/test_assets/users/students.testdata.js'; | import { makeTestStudents } from '../tests/test_assets/users/students.testdata.js'; | ||||||
| import { makeTestTeachers } from '../tests/test_assets/users/teachers.testdata.js'; | import { makeTestTeachers } from '../tests/test_assets/users/teachers.testdata.js'; | ||||||
| import { getLogger, Logger } from '../src/logging/initalize.js'; | import { getLogger, Logger } from '../src/logging/initalize.js'; | ||||||
|  | import { Collection } from '@mikro-orm/core'; | ||||||
|  | import { Group } from '../dist/entities/assignments/group.entity.js'; | ||||||
| 
 | 
 | ||||||
| const logger: Logger = getLogger(); | const logger: Logger = getLogger(); | ||||||
| 
 | 
 | ||||||
|  | @ -34,8 +36,8 @@ export async function seedDatabase(): Promise<void> { | ||||||
|     const assignments = makeTestAssignemnts(em, classes); |     const assignments = makeTestAssignemnts(em, classes); | ||||||
|     const groups = makeTestGroups(em, students, assignments); |     const groups = makeTestGroups(em, students, assignments); | ||||||
| 
 | 
 | ||||||
|     assignments[0].groups = groups.slice(0, 3); |     assignments[0].groups = new Collection<Group>(groups.slice(0, 3)); | ||||||
|     assignments[1].groups = groups.slice(3, 4); |     assignments[1].groups = new Collection<Group>(groups.slice(3, 4)); | ||||||
| 
 | 
 | ||||||
|     const teacherInvitations = makeTestTeacherInvitations(em, teachers, classes); |     const teacherInvitations = makeTestTeacherInvitations(em, teachers, classes); | ||||||
|     const classJoinRequests = makeTestClassJoinRequests(em, students, classes); |     const classJoinRequests = makeTestClassJoinRequests(em, students, classes); | ||||||
|  | @ -43,7 +45,7 @@ export async function seedDatabase(): Promise<void> { | ||||||
| 
 | 
 | ||||||
|     learningObjects[1].attachments = attachments; |     learningObjects[1].attachments = attachments; | ||||||
| 
 | 
 | ||||||
|     const questions = makeTestQuestions(em, students); |     const questions = makeTestQuestions(em, students, groups); | ||||||
|     const answers = makeTestAnswers(em, teachers, questions); |     const answers = makeTestAnswers(em, teachers, questions); | ||||||
|     const submissions = makeTestSubmissions(em, students, groups); |     const submissions = makeTestSubmissions(em, students, groups); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Reference in a new issue
	
	 Laure Jablonski
						Laure Jablonski