From 8edd4f02251d96769f0329836b580ab8e1680d52 Mon Sep 17 00:00:00 2001 From: Gerald Schmittinger Date: Tue, 20 May 2025 13:26:39 +0200 Subject: [PATCH] fix: Logica vragen stellen gecorrigeerd (WIP) --- backend/src/data/questions/question-repository.ts | 9 ++------- backend/src/entities/questions/question.entity.ts | 6 +++--- frontend/src/components/QuestionBox.vue | 11 ++++++----- frontend/src/controllers/questions.ts | 2 +- .../src/views/learning-paths/LearningPathPage.vue | 10 +++++----- 5 files changed, 17 insertions(+), 21 deletions(-) diff --git a/backend/src/data/questions/question-repository.ts b/backend/src/data/questions/question-repository.ts index 6a3c0ead..a07a0a94 100644 --- a/backend/src/data/questions/question-repository.ts +++ b/backend/src/data/questions/question-repository.ts @@ -18,13 +18,8 @@ export class QuestionRepository extends DwengoEntityRepository { content: question.content, timestamp: new Date(), }); - await this.insert(questionEntity); - questionEntity.learningObjectHruid = question.loId.hruid; - questionEntity.learningObjectLanguage = question.loId.language; - questionEntity.learningObjectVersion = question.loId.version; - questionEntity.author = question.author; - questionEntity.inGroup = question.inGroup; - questionEntity.content = question.content; + console.log(questionEntity) + await this.save(questionEntity, { preventOverwrite: true }); return questionEntity; } public async findAllQuestionsAboutLearningObject(loId: LearningObjectIdentifier): Promise { diff --git a/backend/src/entities/questions/question.entity.ts b/backend/src/entities/questions/question.entity.ts index 44ccfbd3..0b41f2f7 100644 --- a/backend/src/entities/questions/question.entity.ts +++ b/backend/src/entities/questions/question.entity.ts @@ -6,6 +6,9 @@ import { Group } from '../assignments/group.entity.js'; @Entity({ repository: () => QuestionRepository }) export class Question { + @PrimaryKey({ type: 'integer', autoincrement: true }) + sequenceNumber?: number; + @PrimaryKey({ type: 'string' }) learningObjectHruid!: string; @@ -18,9 +21,6 @@ export class Question { @PrimaryKey({ type: 'number' }) learningObjectVersion = 1; - @PrimaryKey({ type: 'integer', autoincrement: true }) - sequenceNumber?: number; - @ManyToOne({ entity: () => Group }) inGroup!: Group; diff --git a/frontend/src/components/QuestionBox.vue b/frontend/src/components/QuestionBox.vue index ef021793..79481975 100644 --- a/frontend/src/components/QuestionBox.vue +++ b/frontend/src/components/QuestionBox.vue @@ -1,6 +1,5 @@