Show assignment results for user
This commit is contained in:
parent
69e96391d9
commit
57a4f447af
|
|
@ -147,8 +147,8 @@ function finishButtonEnabled() {
|
|||
{{ $t("general.backCapitalized") }}
|
||||
</button>
|
||||
<button
|
||||
:disabled="!nextButtonEnabled()"
|
||||
v-if="state.pageIndex <= numTasks"
|
||||
:disabled="!nextButtonEnabled()"
|
||||
class="btn-secondary z-10 flex items-center"
|
||||
data-cy="next-step"
|
||||
@click="nextPage()"
|
||||
|
|
@ -158,8 +158,8 @@ function finishButtonEnabled() {
|
|||
</button>
|
||||
|
||||
<button
|
||||
:disabled="!finishButtonEnabled()"
|
||||
v-if="state.pageIndex > numTasks"
|
||||
:disabled="!finishButtonEnabled()"
|
||||
class="btn-secondary z-10 flex items-center"
|
||||
data-cy="next-step"
|
||||
@click="$emit('close')"
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ const props = defineProps<{
|
|||
assignmentUser: CourseSessionUser;
|
||||
assignment: Assignment;
|
||||
assignmentCompletion: AssignmentCompletion;
|
||||
showEvaluationUser?: boolean;
|
||||
dueDate?: Dayjs;
|
||||
}>();
|
||||
|
||||
|
|
@ -43,7 +44,7 @@ async function submitEvaluation() {
|
|||
course_session_id: courseSessionsStore.currentCourseSession!.id,
|
||||
completion_data: {},
|
||||
completion_status: "evaluation_submitted",
|
||||
evaluation_grade: grade.value,
|
||||
evaluation_grade: grade.value ?? undefined,
|
||||
evaluation_points: userPoints.value,
|
||||
});
|
||||
state.showSuccessInfo = true;
|
||||
|
|
@ -69,16 +70,36 @@ const maxPoints = computed(() => maxAssignmentPoints(props.assignment));
|
|||
const userPoints = computed(() =>
|
||||
userAssignmentPoints(props.assignment, props.assignmentCompletion)
|
||||
);
|
||||
const grade = computed(() => pointsToGrade(userPoints.value, maxPoints.value));
|
||||
const grade = computed(() => {
|
||||
if (props.assignmentCompletion.completion_status === "evaluation_submitted") {
|
||||
return props.assignmentCompletion.evaluation_grade;
|
||||
}
|
||||
return pointsToGrade(userPoints.value, maxPoints.value);
|
||||
});
|
||||
|
||||
const evaluationUser = computed(() => {
|
||||
if (props.assignmentCompletion.evaluation_user) {
|
||||
return (courseSessionsStore.currentCourseSession?.users ?? []).find(
|
||||
(user) => user.user_id === Number(props.assignmentCompletion.evaluation_user)
|
||||
) as CourseSessionUser;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<h3 class="mb-6">Bewertung Freigabe</h3>
|
||||
<h3 v-if="evaluationUser && props.showEvaluationUser" class="mb-6">
|
||||
Bewertung von {{ evaluationUser.first_name }} {{ evaluationUser.last_name }}
|
||||
</h3>
|
||||
<h3 v-else class="mb-6">Bewertung Freigabe</h3>
|
||||
|
||||
<section class="mb-6 border p-6">
|
||||
<div class="text-lg font-bold">Note: {{ grade }}</div>
|
||||
<div>Gesamtpunktezahl {{ userPoints }} / {{ maxPoints }}</div>
|
||||
<div class="text-gray-900">
|
||||
Gesamtpunktezahl {{ userPoints }} / {{ maxPoints }}
|
||||
</div>
|
||||
|
||||
<p class="my-4">
|
||||
Die Gesamtpunktzahl und die daraus resultierende Note wird auf Grund des
|
||||
|
|
|
|||
|
|
@ -115,7 +115,6 @@ async function uploadDocument(data: DocumentUploadData) {
|
|||
data,
|
||||
courseSessionsStore.currentCourseSession.id
|
||||
);
|
||||
const courseSessionsStore = useCourseSessionsStore();
|
||||
courseSessionsStore.addDocument(newDocument);
|
||||
showUploadModal.value = false;
|
||||
isUploading.value = false;
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ const props = withDefaults(defineProps<Props>(), {
|
|||
<template>
|
||||
<h3 class="mt-8">{{ $t("assignment.initialSituationTitle") }}</h3>
|
||||
<p
|
||||
class="default-wagtail-rich-text text-large"
|
||||
v-if="props.assignment.starting_position"
|
||||
class="default-wagtail-rich-text text-large"
|
||||
v-html="props.assignment.starting_position"
|
||||
></p>
|
||||
|
||||
|
|
@ -60,11 +60,15 @@ const props = withDefaults(defineProps<Props>(), {
|
|||
|
||||
<h3 class="mt-8">{{ $t("assignment.assessmentTitle") }}</h3>
|
||||
<p
|
||||
v-if="props.assignment.evaluation_description"
|
||||
class="default-wagtail-rich-text text-large"
|
||||
v-html="props.assignment.evaluation_description"
|
||||
v-if="props.assignment.evaluation_description"
|
||||
></p>
|
||||
<a :href="props.assignment.evaluation_document_url" class="text-large underline">
|
||||
<a
|
||||
:href="props.assignment.evaluation_document_url"
|
||||
target="_blank"
|
||||
class="text-large link"
|
||||
>
|
||||
{{ $t("assignment.showAssessmentDocument") }}
|
||||
</a>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -1,14 +1,17 @@
|
|||
<script setup lang="ts">
|
||||
import EvaluationSummary from "@/pages/cockpit/assignmentEvaluationPage/EvaluationSummary.vue";
|
||||
import AssignmentIntroductionView from "@/pages/learningPath/learningContentPage/assignment/AssignmentIntroductionView.vue";
|
||||
import AssignmentSubmissionView from "@/pages/learningPath/learningContentPage/assignment/AssignmentSubmissionView.vue";
|
||||
import AssignmentTaskView from "@/pages/learningPath/learningContentPage/assignment/AssignmentTaskView.vue";
|
||||
import LearningContentMultiLayout from "@/pages/learningPath/learningContentPage/layouts/LearningContentMultiLayout.vue";
|
||||
import { useAssignmentStore } from "@/stores/assignmentStore";
|
||||
import { useCourseSessionsStore } from "@/stores/courseSessions";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
import type {
|
||||
Assignment,
|
||||
AssignmentTask,
|
||||
CourseSessionAssignmentDetails,
|
||||
CourseSessionUser,
|
||||
LearningContent,
|
||||
} from "@/types";
|
||||
import dayjs from "dayjs";
|
||||
|
|
@ -19,6 +22,7 @@ import { useI18n } from "vue-i18n";
|
|||
const { t } = useI18n();
|
||||
const courseSessionsStore = useCourseSessionsStore();
|
||||
const assignmentStore = useAssignmentStore();
|
||||
const userStore = useUserStore();
|
||||
|
||||
interface State {
|
||||
assignment: Assignment | undefined;
|
||||
|
|
@ -70,9 +74,7 @@ onMounted(async () => {
|
|||
|
||||
const numTasks = computed(() => state.assignment?.tasks?.length ?? 0);
|
||||
const numPages = computed(() => numTasks.value + 2);
|
||||
const showPreviousButton = computed(
|
||||
() => state.pageIndex != 0 && completionStatus.value === "in_progress"
|
||||
);
|
||||
const showPreviousButton = computed(() => state.pageIndex != 0);
|
||||
const showNextButton = computed(() => state.pageIndex + 1 < numPages.value);
|
||||
const showExitButton = computed(() => numPages.value === state.pageIndex + 1);
|
||||
const dueDate = computed(() =>
|
||||
|
|
@ -121,45 +123,70 @@ const getTitle = () => {
|
|||
}
|
||||
return currentTask?.value?.value.title ?? "Unknown";
|
||||
};
|
||||
|
||||
const assignmentUser = computed(() => {
|
||||
return (courseSessionsStore.currentCourseSession?.users ?? []).find(
|
||||
(user) => user.user_id === Number(userStore.id)
|
||||
) as CourseSessionUser;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="state.assignment && assignmentCompletion"></div>
|
||||
<LearningContentMultiLayout
|
||||
:current-step="state.pageIndex"
|
||||
:subtitle="state.assignment?.title ?? ''"
|
||||
:title="getTitle()"
|
||||
learning-content-type="assignment"
|
||||
:steps-count="numPages"
|
||||
:show-next-button="showNextButton"
|
||||
:show-exit-button="showExitButton"
|
||||
:show-start-button="false"
|
||||
:show-previous-button="showPreviousButton"
|
||||
start-badge-text="Einleitung"
|
||||
end-badge-text="Abgabe"
|
||||
close-button-variant="close"
|
||||
@previous="handleBack()"
|
||||
@next="handleContinue()"
|
||||
>
|
||||
<div>
|
||||
<AssignmentIntroductionView
|
||||
v-if="state.pageIndex === 0 && state.assignment"
|
||||
:due-date="dueDate"
|
||||
:assignment="state.assignment!"
|
||||
></AssignmentIntroductionView>
|
||||
<AssignmentTaskView
|
||||
v-if="currentTask"
|
||||
:task="currentTask"
|
||||
:assignment-id="props.assignmentId"
|
||||
></AssignmentTaskView>
|
||||
<AssignmentSubmissionView
|
||||
v-if="state.pageIndex + 1 === numPages && state.assignment && courseSessionId"
|
||||
:due-date="dueDate"
|
||||
:assignment="state.assignment!"
|
||||
:assignment-completion-data="assignmentCompletion?.completion_data ?? {}"
|
||||
:course-session-id="courseSessionId!"
|
||||
@edit-task="jumpToTask($event)"
|
||||
></AssignmentSubmissionView>
|
||||
<div v-if="state.assignment && assignmentCompletion">
|
||||
<div class="flex">
|
||||
<LearningContentMultiLayout
|
||||
:current-step="state.pageIndex"
|
||||
:subtitle="state.assignment?.title ?? ''"
|
||||
:title="getTitle()"
|
||||
learning-content-type="assignment"
|
||||
:steps-count="numPages"
|
||||
:show-next-button="showNextButton"
|
||||
:show-exit-button="showExitButton"
|
||||
:show-start-button="false"
|
||||
:show-previous-button="showPreviousButton"
|
||||
start-badge-text="Einleitung"
|
||||
end-badge-text="Abgabe"
|
||||
close-button-variant="close"
|
||||
@previous="handleBack()"
|
||||
@next="handleContinue()"
|
||||
>
|
||||
<div class="flex">
|
||||
<div>
|
||||
<AssignmentIntroductionView
|
||||
v-if="state.pageIndex === 0 && state.assignment"
|
||||
:due-date="dueDate"
|
||||
:assignment="state.assignment!"
|
||||
></AssignmentIntroductionView>
|
||||
<AssignmentTaskView
|
||||
v-if="currentTask"
|
||||
:task="currentTask"
|
||||
:assignment-id="props.assignmentId"
|
||||
></AssignmentTaskView>
|
||||
<AssignmentSubmissionView
|
||||
v-if="
|
||||
state.pageIndex + 1 === numPages && state.assignment && courseSessionId
|
||||
"
|
||||
:due-date="dueDate"
|
||||
:assignment="state.assignment!"
|
||||
:assignment-completion-data="assignmentCompletion?.completion_data ?? {}"
|
||||
:course-session-id="courseSessionId!"
|
||||
@edit-task="jumpToTask($event)"
|
||||
></AssignmentSubmissionView>
|
||||
</div>
|
||||
</div>
|
||||
</LearningContentMultiLayout>
|
||||
<div
|
||||
v-if="assignmentCompletion?.completion_status === 'evaluation_submitted'"
|
||||
class="min-w-2/5 mr-4 bg-gray-200 px-6 py-6"
|
||||
>
|
||||
<EvaluationSummary
|
||||
v-if="state.assignment"
|
||||
:assignment-user="assignmentUser"
|
||||
:assignment="state.assignment"
|
||||
:assignment-completion="assignmentCompletion"
|
||||
:show-evaluation-user="true"
|
||||
></EvaluationSummary>
|
||||
</div>
|
||||
</div>
|
||||
</LearningContentMultiLayout>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -547,6 +547,7 @@ export interface AssignmentCompletion {
|
|||
completion_status: AssignmentCompletionStatus;
|
||||
evaluation_user: number | null;
|
||||
completion_data: AssignmentCompletionData;
|
||||
evaluation_grade: number | null;
|
||||
}
|
||||
|
||||
export type UpsertUserAssignmentCompletion = {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,3 @@
|
|||
from wagtail.blocks import StreamValue
|
||||
from wagtail.blocks.list_block import ListBlock, ListValue
|
||||
from wagtail.rich_text import RichText
|
||||
|
||||
from vbv_lernwelt.assignment.models import (
|
||||
EvaluationSubTaskBlock,
|
||||
TaskContentStreamBlock,
|
||||
|
|
@ -19,6 +15,9 @@ from vbv_lernwelt.assignment.tests.assignment_factories import (
|
|||
from vbv_lernwelt.core.utils import replace_whitespace
|
||||
from vbv_lernwelt.course.consts import COURSE_TEST_ID, COURSE_UK
|
||||
from vbv_lernwelt.course.models import CoursePage
|
||||
from wagtail.blocks import StreamValue
|
||||
from wagtail.blocks.list_block import ListBlock, ListValue
|
||||
from wagtail.rich_text import RichText
|
||||
|
||||
|
||||
def create_uk_assignments(course_id=COURSE_UK):
|
||||
|
|
|
|||
|
|
@ -19,4 +19,6 @@ class AssignmentCompletionSerializer(serializers.ModelSerializer):
|
|||
"completion_data",
|
||||
"evaluation_user",
|
||||
"additional_json_data",
|
||||
"evaluation_grade",
|
||||
"evaluation_points",
|
||||
]
|
||||
|
|
|
|||
Loading…
Reference in New Issue