diff --git a/client/src/components/FeedbackForm.vue b/client/src/components/FeedbackForm.vue index e9b7596e..c53f4c97 100644 --- a/client/src/components/FeedbackForm.vue +++ b/client/src/components/FeedbackForm.vue @@ -103,7 +103,7 @@ const sendFeedback = () => { preparation_task_clarity: preparationTaskClarity, course_negative_feedback: courseNegativeFeedback, course_positive_feedback: coursePositiveFeedback, - goald_attainment: goalAttainment, + goal_attainment: goalAttainment, instructor_competence: instructorCompetence, instructor_respect: instructorRespect, instructor_open_feedback: instructorOpenFeedback, @@ -119,9 +119,8 @@ const sendFeedback = () => { }); log.debug(variables); executeMutation(variables) - .then(({ data, error }) => { + .then(({ data }) => { log.debug(data); - log.error(error); mutationResult.value = data; }) .catch((e) => log.error(e)); @@ -142,6 +141,7 @@ const sendFeedback = () => { :start-badge-text="$t('general.introduction')" :end-badge-text="$t('general.submission')" :base-url="props.page.frontend_url" + close-button-variant="close" @previous="previousStep()" @next="nextStep()" > diff --git a/client/src/pages/cockpit/cockpitPage/AssignmentSubmissionProgress.vue b/client/src/pages/cockpit/cockpitPage/AssignmentSubmissionProgress.vue index 43349f10..3cf25ea7 100644 --- a/client/src/pages/cockpit/cockpitPage/AssignmentSubmissionProgress.vue +++ b/client/src/pages/cockpit/cockpitPage/AssignmentSubmissionProgress.vue @@ -83,7 +83,9 @@ const totalCount = (status: StatusCount) => {
{{ @@ -93,14 +95,6 @@ const totalCount = (status: StatusCount) => { }) }}
-
- {{ - $t("x von y abgeschlossen", { - x: doneCount(state.submissionProgressStatusCount), - y: totalCount(state.submissionProgressStatusCount), - }) - }} -
diff --git a/client/src/pages/learningPath/learningContentPage/assignment/AssignmentSubmissionView.vue b/client/src/pages/learningPath/learningContentPage/assignment/AssignmentSubmissionView.vue index 11d1b14c..1e127da7 100644 --- a/client/src/pages/learningPath/learningContentPage/assignment/AssignmentSubmissionView.vue +++ b/client/src/pages/learningPath/learningContentPage/assignment/AssignmentSubmissionView.vue @@ -15,6 +15,7 @@ import type { Dayjs } from "dayjs"; import log from "loglevel"; import { computed, reactive } from "vue"; import { useTranslation } from "i18next-vue"; +import eventBus from "@/utils/eventBus"; const props = defineProps<{ assignment: Assignment; @@ -53,6 +54,15 @@ const completionData = computed(() => { return props.assignmentCompletion?.completion_data ?? {}; }); +const canSubmit = computed(() => { + return ( + !state.confirmInput || + (props.assignment.assignment_type === "CASEWORK" && !state.confirmPerson) + ); +}); + +const isCasework = computed(() => props.assignment.assignment_type === "CASEWORK"); + const upsertAssignmentCompletionMutation = useMutation( UPSERT_ASSIGNMENT_COMPLETION_MUTATION ); @@ -76,6 +86,7 @@ const onSubmit = async () => { bustItGetCache( `/api/course/completion/${courseSession.value.id}/${useUserStore().id}/` ); + eventBus.emit("finishedLearningContent", true); } catch (error) { log.error("Could not submit assignment", error); } @@ -98,7 +109,7 @@ const onSubmit = async () => { data-cy="confirm-submit-results" @toggle="state.confirmInput = !state.confirmInput" > -
+
+

{{ $t("assignment.assessmentDocumentDisclaimer") }}

{{ $t("assignment.showAssessmentDocument") }}
-

+

{{ $t("assignment.dueDateSubmission") }}

@@ -147,7 +158,7 @@ const onSubmit = async () => { :text="t('assignment.assignmentSubmitted')" data-cy="success-text" > -

+

{{ $t("assignment.submissionNotificationDisclaimer", { name: circleExpertName }) }} diff --git a/client/src/pages/learningPath/learningContentPage/assignment/AssignmentView.vue b/client/src/pages/learningPath/learningContentPage/assignment/AssignmentView.vue index 591958b0..db6f13a1 100644 --- a/client/src/pages/learningPath/learningContentPage/assignment/AssignmentView.vue +++ b/client/src/pages/learningPath/learningContentPage/assignment/AssignmentView.vue @@ -12,6 +12,7 @@ import { useUserStore } from "@/stores/user"; import type { Assignment, AssignmentCompletion, + AssignmentCompletionStatus, AssignmentTask, CourseSessionAssignment, CourseSessionUser, @@ -23,6 +24,7 @@ import dayjs from "dayjs"; import * as log from "loglevel"; import { computed, onMounted, reactive } from "vue"; import { useTranslation } from "i18next-vue"; +import { bustItGetCache } from "@/fetchHelpers"; import { learningContentTypeData } from "@/utils/typeMaps"; const { t } = useTranslation(); @@ -87,16 +89,7 @@ onMounted(async () => { // create initial `AssignmentCompletion` first, so that it exists and we don't // have reactivity problem accessing it. - await upsertAssignmentCompletionMutation.executeMutation({ - assignmentId: props.learningContent.content_assignment_id.toString(), - courseSessionId: courseSession.value.id.toString(), - learningContentId: props.learningContent.id.toString(), - completionDataString: JSON.stringify({}), - completionStatus: "IN_PROGRESS", - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - id: assignmentCompletion.value?.id, - }); + await upsertAssignmentCompletion("IN_PROGRESS"); queryResult.resume(); try { @@ -113,16 +106,10 @@ onMounted(async () => { const numTasks = computed(() => assignment.value?.tasks?.length ?? 0); const numPages = computed(() => { - if (assignmentType.value === "CASEWORK") { - // casework has extra submission page - return numTasks.value + 2; - } - - return numTasks.value + 1; + return numTasks.value + 2; }); const showPreviousButton = computed(() => stepIndex.value != 0); const showNextButton = computed(() => stepIndex.value + 1 < numPages.value); -const showExitButton = computed(() => numPages.value === stepIndex.value + 1); const dueDate = computed(() => dayjs(state.courseSessionAssignment?.submission_deadline_start) ); @@ -133,6 +120,26 @@ const currentTask = computed(() => { return undefined; }); +const upsertAssignmentCompletion = async (status: AssignmentCompletionStatus) => { + try { + await upsertAssignmentCompletionMutation.executeMutation({ + assignmentId: props.learningContent.content_assignment_id.toString(), + courseSessionId: courseSession.value.id.toString(), + learningContentId: props.learningContent.id.toString(), + completionDataString: JSON.stringify({}), + completionStatus: status, + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + id: assignmentCompletion.value?.id, + }); + bustItGetCache( + `/api/course/completion/${courseSession.value.id}/${useUserStore().id}/` + ); + } catch (error) { + log.error("Could not submit assignment", error); + } +}; + const handleBack = () => { log.debug("handleBack"); if (stepIndex.value > 0) { @@ -161,19 +168,12 @@ const jumpToTask = (task: AssignmentTask) => { const getTitle = () => { if (0 === stepIndex.value) { return t("general.introduction"); - } else if ( - assignmentType.value === "CASEWORK" && - stepIndex.value === numPages.value - 1 - ) { + } else if (stepIndex.value === numPages.value - 1) { return t("general.submission"); } return currentTask?.value?.value.title ?? "Unknown"; }; -const assignmentType = computed(() => { - return assignment.value?.assignment_type ?? "CASEWORK"; -}); - const subTitle = computed(() => { if (assignment.value) { const prefix = learningContentTypeData(props.learningContent).title; @@ -187,19 +187,6 @@ const assignmentUser = computed(() => { (user) => user.user_id === userStore.id ) as CourseSessionUser; }); - -const endBadgeText = computed(() => { - if (assignmentType.value === "PREP_ASSIGNMENT") { - return t("Aufgaben"); - } else if (assignmentType.value === "CASEWORK") { - return t("Abgabe"); - } else if (assignmentType.value === "CONDITION_ACCEPTANCE") { - return t("Akzeptieren"); - } - - // just return the number of tasks as default - return (assignment.value?.tasks.length ?? 0).toString(); -});