fix: oplossing 2 voor seeden geimplementeerd (zie comment op #184)
This commit is contained in:
		
							parent
							
								
									c6ce2e7e2c
								
							
						
					
					
						commit
						5f1249bd78
					
				
					 3 changed files with 9 additions and 11 deletions
				
			
		|  | @ -5,6 +5,7 @@ import { Language } from '@dwengo-1/common/util/language'; | ||||||
| 
 | 
 | ||||||
| export function makeTestAssignemnts(em: EntityManager, classes: Class[]): Assignment[] { | export function makeTestAssignemnts(em: EntityManager, classes: Class[]): Assignment[] { | ||||||
|     const assignment01 = em.create(Assignment, { |     const assignment01 = em.create(Assignment, { | ||||||
|  |         id: 21000, | ||||||
|         within: classes[0], |         within: classes[0], | ||||||
|         title: 'dire straits', |         title: 'dire straits', | ||||||
|         description: 'reading', |         description: 'reading', | ||||||
|  | @ -14,6 +15,7 @@ export function makeTestAssignemnts(em: EntityManager, classes: Class[]): Assign | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     const assignment02 = em.create(Assignment, { |     const assignment02 = em.create(Assignment, { | ||||||
|  |         id: 21001, | ||||||
|         within: classes[1], |         within: classes[1], | ||||||
|         title: 'tool', |         title: 'tool', | ||||||
|         description: 'reading', |         description: 'reading', | ||||||
|  | @ -23,6 +25,7 @@ export function makeTestAssignemnts(em: EntityManager, classes: Class[]): Assign | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     const assignment03 = em.create(Assignment, { |     const assignment03 = em.create(Assignment, { | ||||||
|  |         id: 21002, | ||||||
|         within: classes[0], |         within: classes[0], | ||||||
|         title: 'delete', |         title: 'delete', | ||||||
|         description: 'will be deleted', |         description: 'will be deleted', | ||||||
|  | @ -32,6 +35,7 @@ export function makeTestAssignemnts(em: EntityManager, classes: Class[]): Assign | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     const assignment04 = em.create(Assignment, { |     const assignment04 = em.create(Assignment, { | ||||||
|  |         id: 21003, | ||||||
|         within: classes[0], |         within: classes[0], | ||||||
|         title: 'another assignment', |         title: 'another assignment', | ||||||
|         description: 'with a description', |         description: 'with a description', | ||||||
|  |  | ||||||
|  | @ -10,7 +10,7 @@ export function makeTestGroups(em: EntityManager, students: Student[], assignmen | ||||||
|      */ |      */ | ||||||
|     const group01 = em.create(Group, { |     const group01 = em.create(Group, { | ||||||
|         assignment: assignments[0], |         assignment: assignments[0], | ||||||
|         groupNumber: 1, |         groupNumber: 21001, | ||||||
|         members: students.slice(0, 2), |         members: students.slice(0, 2), | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|  | @ -20,7 +20,7 @@ export function makeTestGroups(em: EntityManager, students: Student[], assignmen | ||||||
|      */ |      */ | ||||||
|     const group02 = em.create(Group, { |     const group02 = em.create(Group, { | ||||||
|         assignment: assignments[0], |         assignment: assignments[0], | ||||||
|         groupNumber: 2, |         groupNumber: 21002, | ||||||
|         members: students.slice(2, 4), |         members: students.slice(2, 4), | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|  | @ -30,7 +30,7 @@ export function makeTestGroups(em: EntityManager, students: Student[], assignmen | ||||||
|      */ |      */ | ||||||
|     const group03 = em.create(Group, { |     const group03 = em.create(Group, { | ||||||
|         assignment: assignments[0], |         assignment: assignments[0], | ||||||
|         groupNumber: 3, |         groupNumber: 21003, | ||||||
|         members: students.slice(4, 6), |         members: students.slice(4, 6), | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|  | @ -40,7 +40,7 @@ export function makeTestGroups(em: EntityManager, students: Student[], assignmen | ||||||
|      */ |      */ | ||||||
|     const group04 = em.create(Group, { |     const group04 = em.create(Group, { | ||||||
|         assignment: assignments[1], |         assignment: assignments[1], | ||||||
|         groupNumber: 4, |         groupNumber: 21004, | ||||||
|         members: students.slice(3, 4), |         members: students.slice(3, 4), | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|  | @ -50,7 +50,7 @@ export function makeTestGroups(em: EntityManager, students: Student[], assignmen | ||||||
|      */ |      */ | ||||||
|     const group05 = em.create(Group, { |     const group05 = em.create(Group, { | ||||||
|         assignment: assignments[3], |         assignment: assignments[3], | ||||||
|         groupNumber: 1, |         groupNumber: 21001, | ||||||
|         members: students.slice(0, 2), |         members: students.slice(0, 2), | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -35,9 +35,6 @@ export async function seedDatabase(): Promise<void> { | ||||||
|     const classes = makeTestClasses(em, students, teachers); |     const classes = makeTestClasses(em, students, teachers); | ||||||
|     const assignments = makeTestAssignemnts(em, classes); |     const assignments = makeTestAssignemnts(em, classes); | ||||||
| 
 | 
 | ||||||
|     /* Wegens een probleem met het aanmaken van groups werd deze code even in commentaar gezet */ |  | ||||||
| 
 |  | ||||||
|     /* |  | ||||||
|     const groups = makeTestGroups(em, students, assignments); |     const groups = makeTestGroups(em, students, assignments); | ||||||
| 
 | 
 | ||||||
|     assignments[0].groups = new Collection<Group>(groups.slice(0, 3)); |     assignments[0].groups = new Collection<Group>(groups.slice(0, 3)); | ||||||
|  | @ -52,7 +49,6 @@ export async function seedDatabase(): Promise<void> { | ||||||
|     const questions = makeTestQuestions(em, students, groups); |     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); | ||||||
|     */ |  | ||||||
| 
 | 
 | ||||||
|     // Persist all entities
 |     // Persist all entities
 | ||||||
|     await em.persistAndFlush([ |     await em.persistAndFlush([ | ||||||
|  | @ -62,7 +58,6 @@ export async function seedDatabase(): Promise<void> { | ||||||
|         ...learningPaths, |         ...learningPaths, | ||||||
|         ...classes, |         ...classes, | ||||||
|         ...assignments, |         ...assignments, | ||||||
|         /* |  | ||||||
|         ...groups, |         ...groups, | ||||||
|         ...teacherInvitations, |         ...teacherInvitations, | ||||||
|         ...classJoinRequests, |         ...classJoinRequests, | ||||||
|  | @ -70,7 +65,6 @@ export async function seedDatabase(): Promise<void> { | ||||||
|         ...questions, |         ...questions, | ||||||
|         ...answers, |         ...answers, | ||||||
|         ...submissions, |         ...submissions, | ||||||
|         */ |  | ||||||
|     ]); |     ]); | ||||||
| 
 | 
 | ||||||
|     logger.info('Development database seeded successfully!'); |     logger.info('Development database seeded successfully!'); | ||||||
|  |  | ||||||
		Reference in a new issue