fix: Logica vragen stellen gecorrigeerd (WIP)
This commit is contained in:
parent
1d9141bab7
commit
8edd4f0225
5 changed files with 17 additions and 21 deletions
|
@ -18,13 +18,8 @@ export class QuestionRepository extends DwengoEntityRepository<Question> {
|
||||||
content: question.content,
|
content: question.content,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
});
|
});
|
||||||
await this.insert(questionEntity);
|
console.log(questionEntity)
|
||||||
questionEntity.learningObjectHruid = question.loId.hruid;
|
await this.save(questionEntity, { preventOverwrite: true });
|
||||||
questionEntity.learningObjectLanguage = question.loId.language;
|
|
||||||
questionEntity.learningObjectVersion = question.loId.version;
|
|
||||||
questionEntity.author = question.author;
|
|
||||||
questionEntity.inGroup = question.inGroup;
|
|
||||||
questionEntity.content = question.content;
|
|
||||||
return questionEntity;
|
return questionEntity;
|
||||||
}
|
}
|
||||||
public async findAllQuestionsAboutLearningObject(loId: LearningObjectIdentifier): Promise<Question[]> {
|
public async findAllQuestionsAboutLearningObject(loId: LearningObjectIdentifier): Promise<Question[]> {
|
||||||
|
|
|
@ -6,6 +6,9 @@ import { Group } from '../assignments/group.entity.js';
|
||||||
|
|
||||||
@Entity({ repository: () => QuestionRepository })
|
@Entity({ repository: () => QuestionRepository })
|
||||||
export class Question {
|
export class Question {
|
||||||
|
@PrimaryKey({ type: 'integer', autoincrement: true })
|
||||||
|
sequenceNumber?: number;
|
||||||
|
|
||||||
@PrimaryKey({ type: 'string' })
|
@PrimaryKey({ type: 'string' })
|
||||||
learningObjectHruid!: string;
|
learningObjectHruid!: string;
|
||||||
|
|
||||||
|
@ -18,9 +21,6 @@ export class Question {
|
||||||
@PrimaryKey({ type: 'number' })
|
@PrimaryKey({ type: 'number' })
|
||||||
learningObjectVersion = 1;
|
learningObjectVersion = 1;
|
||||||
|
|
||||||
@PrimaryKey({ type: 'integer', autoincrement: true })
|
|
||||||
sequenceNumber?: number;
|
|
||||||
|
|
||||||
@ManyToOne({ entity: () => Group })
|
@ManyToOne({ entity: () => Group })
|
||||||
inGroup!: Group;
|
inGroup!: Group;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import authService from "@/services/auth/auth-service.ts";
|
import authService from "@/services/auth/auth-service.ts";
|
||||||
import { Language } from "@/data-objects/language.ts";
|
|
||||||
import { computed, type ComputedRef, ref } from "vue";
|
import { computed, type ComputedRef, ref } from "vue";
|
||||||
import type { GroupDTOId } from "@dwengo-1/common/interfaces/group";
|
import type { GroupDTOId } from "@dwengo-1/common/interfaces/group";
|
||||||
import type { QuestionData } from "@dwengo-1/common/interfaces/question";
|
import type { QuestionData } from "@dwengo-1/common/interfaces/question";
|
||||||
|
@ -10,9 +9,9 @@
|
||||||
import { AccountType } from "@dwengo-1/common/util/account-types.ts";
|
import { AccountType } from "@dwengo-1/common/util/account-types.ts";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
hruid: string;
|
learningObjectHruid: string;
|
||||||
language: Language;
|
learningObjectLanguage: string;
|
||||||
learningObjectHruid?: string;
|
learningObjectVersion: number;
|
||||||
forGroup?: GroupDTOId | undefined;
|
forGroup?: GroupDTOId | undefined;
|
||||||
withTitle?: boolean;
|
withTitle?: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
@ -25,7 +24,8 @@
|
||||||
|
|
||||||
const loID: ComputedRef<LearningObjectIdentifierDTO> = computed(() => ({
|
const loID: ComputedRef<LearningObjectIdentifierDTO> = computed(() => ({
|
||||||
hruid: props.learningObjectHruid as string,
|
hruid: props.learningObjectHruid as string,
|
||||||
language: props.language,
|
language: props.learningObjectLanguage,
|
||||||
|
version: props.learningObjectVersion
|
||||||
}));
|
}));
|
||||||
const createQuestionMutation = useCreateQuestionMutation(loID);
|
const createQuestionMutation = useCreateQuestionMutation(loID);
|
||||||
|
|
||||||
|
@ -56,6 +56,7 @@
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<h3 v-if="props.withTitle && showQuestionBox">{{ t("askAQuestion") }}:</h3>
|
<h3 v-if="props.withTitle && showQuestionBox">{{ t("askAQuestion") }}:</h3>
|
||||||
|
{{ props.forGroup }}
|
||||||
<div
|
<div
|
||||||
class="question-box"
|
class="question-box"
|
||||||
v-if="showQuestionBox"
|
v-if="showQuestionBox"
|
||||||
|
|
|
@ -14,7 +14,7 @@ export class QuestionController extends BaseController {
|
||||||
loId: LearningObjectIdentifierDTO;
|
loId: LearningObjectIdentifierDTO;
|
||||||
|
|
||||||
constructor(loId: LearningObjectIdentifierDTO) {
|
constructor(loId: LearningObjectIdentifierDTO) {
|
||||||
super(`learningObject/${loId.hruid}/:${loId.version}/questions`);
|
super(`learningObject/${loId.hruid}/${loId.version}/questions`);
|
||||||
this.loId = loId;
|
this.loId = loId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -339,7 +339,7 @@
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</div>
|
</div>
|
||||||
<using-query-result
|
<using-query-result
|
||||||
v-if="forGroup"
|
v-if="currentNode && forGroup"
|
||||||
:query-result="getQuestionsQuery"
|
:query-result="getQuestionsQuery"
|
||||||
v-slot="questionsResponse: { data: QuestionsResponse }"
|
v-slot="questionsResponse: { data: QuestionsResponse }"
|
||||||
>
|
>
|
||||||
|
@ -354,10 +354,10 @@
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<QuestionBox
|
<QuestionBox
|
||||||
:hruid="props.hruid"
|
:learningObjectHruid="currentNode.learningobjectHruid"
|
||||||
:language="props.language"
|
:learningObjectLanguage="currentNode.language"
|
||||||
:learningObjectHruid="props.learningObjectHruid"
|
:learningObjectVersion="currentNode.version"
|
||||||
:forGroup="forGroup"
|
:forGroup="{assignment: forGroup.assignmentNo, class: forGroup.classId, groupNumber: forGroup.forGroup}"
|
||||||
@updated="refetchQuestions"
|
@updated="refetchQuestions"
|
||||||
/>
|
/>
|
||||||
<QandA :questions="(questionsResponse.data.questions as QuestionDTO[]) ?? []" />
|
<QandA :questions="(questionsResponse.data.questions as QuestionDTO[]) ?? []" />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue