fix: Vragen stellen

This commit is contained in:
Gerald Schmittinger 2025-05-20 13:44:45 +02:00
parent 85221b4cfe
commit 762131ed34
4 changed files with 6 additions and 11 deletions

View file

@ -18,8 +18,8 @@ export class QuestionRepository extends DwengoEntityRepository<Question> {
content: question.content, content: question.content,
timestamp: new Date(), timestamp: new Date(),
}); });
console.log(questionEntity) // Don't check for overwrite since this is impossible anyway due to autoincrement.
await this.save(questionEntity, { preventOverwrite: true }); await this.save(questionEntity, { preventOverwrite: false });
return questionEntity; return questionEntity;
} }
public async findAllQuestionsAboutLearningObject(loId: LearningObjectIdentifier): Promise<Question[]> { public async findAllQuestionsAboutLearningObject(loId: LearningObjectIdentifier): Promise<Question[]> {

View file

@ -54,7 +54,6 @@
<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"

View file

@ -9,6 +9,7 @@ import {
useQueryClient, useQueryClient,
type UseQueryReturnType, type UseQueryReturnType,
} from "@tanstack/vue-query"; } from "@tanstack/vue-query";
import type { Language } from "@dwengo-1/common/util/language";
export function questionsQueryKey( export function questionsQueryKey(
loId: LearningObjectIdentifierDTO, loId: LearningObjectIdentifierDTO,
@ -23,7 +24,7 @@ export function questionsGroupQueryKey(
assignmentId: string, assignmentId: string,
student: string, student: string,
full: boolean, full: boolean,
): [string, string, number, string, boolean] { ): [string, string, number, Language, boolean, string, string, string] {
return ["questions", loId.hruid, loId.version!, loId.language, full, classId, assignmentId, student]; return ["questions", loId.hruid, loId.version!, loId.language, full, classId, assignmentId, student];
} }
@ -54,10 +55,10 @@ export function useQuestionsGroupQuery(
queryKey: computed(() => queryKey: computed(() =>
questionsGroupQueryKey( questionsGroupQueryKey(
toValue(loId), toValue(loId),
toValue(full),
toValue(classId), toValue(classId),
toValue(assignmentId), toValue(assignmentId),
toValue(student), toValue(student),
toValue(full),
), ),
), ),
queryFn: async () => queryFn: async () =>

View file

@ -105,10 +105,6 @@
); );
} }
function refetchQuestions() {
getQuestionsQuery.refetch();
}
const navigationDrawerShown = ref(true); const navigationDrawerShown = ref(true);
function isLearningObjectCompleted(learningObject: LearningObject): boolean { function isLearningObjectCompleted(learningObject: LearningObject): boolean {
@ -292,7 +288,7 @@
</v-list-item> </v-list-item>
<v-list-item> <v-list-item>
<div <div
v-if="authService.authState.activeRole === AccountType.Student && pathIsAssignment" v-if="authService.authState.activeRole === AccountType.Student && forGroup"
class="assignment-indicator" class="assignment-indicator"
> >
{{ t("assignmentIndicator") }} {{ t("assignmentIndicator") }}
@ -358,7 +354,6 @@
:learningObjectLanguage="currentNode.language" :learningObjectLanguage="currentNode.language"
:learningObjectVersion="currentNode.version" :learningObjectVersion="currentNode.version"
:forGroup="{assignment: forGroup.assignmentNo, class: forGroup.classId, groupNumber: forGroup.forGroup}" :forGroup="{assignment: forGroup.assignmentNo, class: forGroup.classId, groupNumber: forGroup.forGroup}"
@updated="refetchQuestions"
/> />
<QandA :questions="(questionsResponse.data.questions as QuestionDTO[]) ?? []" /> <QandA :questions="(questionsResponse.data.questions as QuestionDTO[]) ?? []" />
</using-query-result> </using-query-result>