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