From a2b3d63d6d593a7cdd283056d20f6665e470a51a Mon Sep 17 00:00:00 2001 From: Daniel Egger Date: Mon, 23 Sep 2024 18:06:08 +0200 Subject: [PATCH 1/8] VBV-731: Bewertungen bearbeiten --- .../evaluation/EvaluationContainer.vue | 75 ++++++-- .../assignment/evaluation/EvaluationIntro.vue | 39 ++-- .../evaluation/EvaluationSummary.vue | 123 ++++++++++--- client/src/gql/gql.ts | 8 +- client/src/gql/graphql.ts | 17 +- client/src/gql/schema.graphql | 10 +- client/src/gql/typenames.ts | 1 - client/src/graphql/mutations.ts | 5 + client/src/graphql/queries.ts | 2 + .../mentorTasks/praxisauftrag.cy.js | 2 +- server/config/settings/base.py | 1 + server/vbv_lernwelt/assignment/admin.py | 53 +++++- .../vbv_lernwelt/assignment/graphql/types.py | 1 + ...nment_create_initial_submission_history.py | 71 ++++++++ ...log_evaluation_points_deducted_and_more.py | 43 +++++ .../0016_script_submission_history.py | 18 ++ server/vbv_lernwelt/assignment/models.py | 17 ++ server/vbv_lernwelt/assignment/services.py | 88 +++++++-- .../assignment/tests/test_services.py | 167 ++++++++++++++++++ 19 files changed, 635 insertions(+), 106 deletions(-) create mode 100644 server/vbv_lernwelt/assignment/management/commands/assignment_create_initial_submission_history.py create mode 100644 server/vbv_lernwelt/assignment/migrations/0015_assignmentcompletionauditlog_evaluation_points_deducted_and_more.py create mode 100644 server/vbv_lernwelt/assignment/migrations/0016_script_submission_history.py diff --git a/client/src/components/assignment/evaluation/EvaluationContainer.vue b/client/src/components/assignment/evaluation/EvaluationContainer.vue index 32ddcc08..7cd18bf6 100644 --- a/client/src/components/assignment/evaluation/EvaluationContainer.vue +++ b/client/src/components/assignment/evaluation/EvaluationContainer.vue @@ -2,13 +2,15 @@ import EvaluationIntro from "@/components/assignment/evaluation/EvaluationIntro.vue"; import EvaluationSummary from "@/components/assignment/evaluation/EvaluationSummary.vue"; import EvaluationTask from "@/components/assignment/evaluation/EvaluationTask.vue"; -import { useCourseSessionDetailQuery } from "@/composables"; +import { useCourseSessionDetailQuery, useCurrentCourseSession } from "@/composables"; +import { UPSERT_ASSIGNMENT_COMPLETION_MUTATION } from "@/graphql/mutations"; import type { Assignment, AssignmentCompletion, AssignmentEvaluationTask, CourseSessionUser, } from "@/types"; +import { useMutation } from "@urql/vue"; import { useRouteQuery } from "@vueuse/router"; import dayjs from "dayjs"; import { findIndex } from "lodash"; @@ -21,10 +23,12 @@ const props = defineProps<{ assignment: Assignment; }>(); -const emit = defineEmits(["close"]); +const emit = defineEmits(["close", "reopen"]); log.debug("UserEvaluation setup"); +const courseSession = useCurrentCourseSession(); + // 0 = introduction, 1 - n = tasks, n+1 = submission const stepIndex = useRouteQuery("step", "0", { transform: Number, mode: "push" }); @@ -58,6 +62,34 @@ function editTask(task: AssignmentEvaluationTask) { stepIndex.value = taskIndex + 1; } +function canReopen() { + return ( + evaluationSubmitted.value && + (props.assignment.assignment_type === "CASEWORK" || + props.assignment.assignment_type === "PRAXIS_ASSIGNMENT") + ); +} + +const upsertAssignmentCompletionMutation = useMutation( + UPSERT_ASSIGNMENT_COMPLETION_MUTATION +); + +async function reopen() { + log.debug("reopen"); + + await upsertAssignmentCompletionMutation.executeMutation({ + assignmentId: props.assignment.id, + courseSessionId: courseSession.value.id, + assignmentUserId: props.assignmentUser.id, + completionStatus: "EVALUATION_IN_PROGRESS", + completionDataString: JSON.stringify({}), + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + id: props.assignmentCompletion?.id, + }); + stepIndex.value = 1; +} + const courseSessionDetailResult = useCourseSessionDetailQuery(); const assignmentDetail = computed(() => { @@ -89,11 +121,11 @@ const taskExpertDataText = computed(() => { const text = computed(() => { if (props.assignment.assignment_type === "CASEWORK") { return { - evaluationFinish: "a.Bewertung abschliessen", + evaluationFinish: "a.Schliessen", }; } else if (props.assignment.assignment_type === "PRAXIS_ASSIGNMENT") { return { - evaluationFinish: "a.Feedback abschliessen", + evaluationFinish: "a.Schliessen", }; } else { return { @@ -109,6 +141,16 @@ function nextButtonEnabled() { return true; } +function previousButtonVisible() { + if ( + stepIndex.value > numTasks.value && + props.assignmentCompletion.completion_status === "EVALUATION_SUBMITTED" + ) { + return false; + } + return true; +} + function finishButtonEnabled() { return props.assignmentCompletion.completion_status === "EVALUATION_SUBMITTED"; } @@ -150,18 +192,19 @@ function finishButtonEnabled() {