Merge remote-tracking branch 'origin/dev' into feat/endpoints-beschermen-met-authenticatie-#105
# Conflicts: # backend/src/services/questions.ts
This commit is contained in:
		
						commit
						e799705a09
					
				
					 32 changed files with 579 additions and 8874 deletions
				
			
		|  | @ -2,6 +2,8 @@ import { EntityManager } from '@mikro-orm/core'; | |||
| import { Answer } from '../../../src/entities/questions/answer.entity'; | ||||
| import { Teacher } from '../../../src/entities/users/teacher.entity'; | ||||
| import { Question } from '../../../src/entities/questions/question.entity'; | ||||
| import { getTestleerkracht1 } from '../users/teachers.testdata'; | ||||
| import { getQuestion07 } from './questions.testdata'; | ||||
| 
 | ||||
| export function makeTestAnswers(em: EntityManager, teachers: Teacher[], questions: Question[]): Answer[] { | ||||
|     const answer01 = em.create(Answer, { | ||||
|  | @ -28,5 +30,21 @@ export function makeTestAnswers(em: EntityManager, teachers: Teacher[], question | |||
|         content: 'answer3', | ||||
|     }); | ||||
| 
 | ||||
|     return [answer01, answer02, answer03]; | ||||
|     const answer04 = em.create(Answer, { | ||||
|         author: getTestleerkracht1(), | ||||
|         toQuestion: getQuestion07(), | ||||
|         sequenceNumber: 1, | ||||
|         timestamp: new Date(), | ||||
|         content: 'this is a test answer', | ||||
|     }); | ||||
| 
 | ||||
|     const answer05 = em.create(Answer, { | ||||
|         author: getTestleerkracht1(), | ||||
|         toQuestion: getQuestion07(), | ||||
|         sequenceNumber: 2, | ||||
|         timestamp: new Date(), | ||||
|         content: 'this is a test answer', | ||||
|     }); | ||||
| 
 | ||||
|     return [answer01, answer02, answer03, answer04, answer05]; | ||||
| } | ||||
|  |  | |||
|  | @ -3,6 +3,9 @@ import { Question } from '../../../src/entities/questions/question.entity'; | |||
| import { Language } from '@dwengo-1/common/util/language'; | ||||
| import { Student } from '../../../src/entities/users/student.entity'; | ||||
| import { Group } from '../../../src/entities/assignments/group.entity'; | ||||
| import { getTestleerling1 } from '../users/students.testdata'; | ||||
| import { testLearningObjectMultipleChoice } from '../content/learning-objects.testdata'; | ||||
| import { getGroup1ConditionalLearningPath } from '../assignments/groups.testdata'; | ||||
| 
 | ||||
| export function makeTestQuestions(em: EntityManager, students: Student[], groups: Group[]): Question[] { | ||||
|     const question01 = em.create(Question, { | ||||
|  | @ -66,10 +69,43 @@ export function makeTestQuestions(em: EntityManager, students: Student[], groups | |||
|         learningObjectHruid: 'id05', | ||||
|         sequenceNumber: 4, | ||||
|         author: students[2], | ||||
|         inGroup: groups[3], // Group #4 for Assignment #2 in class 'id02'
 | ||||
|         inGroup: groups[5], // Group #4 for Assignment #2 in class 'id02'
 | ||||
|         timestamp: new Date(), | ||||
|         content: 'question', | ||||
|     }); | ||||
| 
 | ||||
|     return [question01, question02, question03, question04, question05, question06]; | ||||
|     question07 = em.create(Question, { | ||||
|         learningObjectLanguage: Language.English, | ||||
|         learningObjectVersion: 1, | ||||
|         learningObjectHruid: testLearningObjectMultipleChoice.hruid, | ||||
|         sequenceNumber: 1, | ||||
|         author: getTestleerling1(), | ||||
|         inGroup: getGroup1ConditionalLearningPath(), | ||||
|         timestamp: new Date(), | ||||
|         content: 'this is a test question', | ||||
|     }); | ||||
| 
 | ||||
|     question08 = em.create(Question, { | ||||
|         learningObjectLanguage: Language.English, | ||||
|         learningObjectVersion: 1, | ||||
|         learningObjectHruid: testLearningObjectMultipleChoice.hruid, | ||||
|         sequenceNumber: 2, | ||||
|         author: getTestleerling1(), | ||||
|         inGroup: getGroup1ConditionalLearningPath(), | ||||
|         timestamp: new Date(), | ||||
|         content: 'this is a second test question', | ||||
|     }); | ||||
| 
 | ||||
|     return [question01, question02, question03, question04, question05, question06, question07, question08]; | ||||
| } | ||||
| 
 | ||||
| let question08: Question; | ||||
| let question07: Question; | ||||
| 
 | ||||
| export function getQuestion07(): Question { | ||||
|     return question07; | ||||
| } | ||||
| 
 | ||||
| export function getQuestion08(): Question { | ||||
|     return question08; | ||||
| } | ||||
|  |  | |||
|  | @ -30,8 +30,8 @@ export function makeTestTeachers(em: EntityManager): Teacher[] { | |||
|     // Makes sure when logged in as testleerkracht1, there exists a corresponding user
 | ||||
|     testleerkracht1 = em.create(Teacher, { | ||||
|         username: 'testleerkracht1', | ||||
|         firstName: 'Kris', | ||||
|         lastName: 'Coolsaet', | ||||
|         firstName: 'David', | ||||
|         lastName: 'Bowie', | ||||
|     }); | ||||
| 
 | ||||
|     return [teacher01, teacher02, teacher03, teacher04, testleerkracht1]; | ||||
|  |  | |||
		Reference in a new issue
	
	 Gabriellvl
						Gabriellvl