Improve display

This commit is contained in:
Daniel Egger 2023-05-05 16:51:03 +02:00
parent 5868468a48
commit e688cf2fc8
3 changed files with 62 additions and 12 deletions

View File

@ -15,7 +15,7 @@ import type {
import dayjs from "dayjs"; import dayjs from "dayjs";
import { findIndex } from "lodash"; import { findIndex } from "lodash";
import * as log from "loglevel"; import * as log from "loglevel";
import { computed, reactive } from "vue"; import { computed, onMounted, reactive } from "vue";
const props = defineProps<{ const props = defineProps<{
assignmentUser: CourseSessionUser; assignmentUser: CourseSessionUser;
@ -31,12 +31,23 @@ interface StateInterface {
} }
const state: StateInterface = reactive({ const state: StateInterface = reactive({
pageIndex: 6, pageIndex: 0,
}); });
const courseSessionStore = useCourseSessionsStore(); const courseSessionStore = useCourseSessionsStore();
const numTasks = computed(() => props.assignment.evaluation_tasks?.length ?? 0); const numTasks = computed(() => props.assignment.evaluation_tasks?.length ?? 0);
const evaluationSubmitted = computed(
() => props.assignmentCompletion.completion_status === "evaluation_submitted"
);
onMounted(() => {
if (evaluationSubmitted.value) {
state.pageIndex = props.assignment.evaluation_tasks?.length + 1 ?? 0;
} else {
state.pageIndex = 0;
}
});
function previousPage() { function previousPage() {
log.debug("previousTask"); log.debug("previousTask");
@ -110,12 +121,14 @@ const dueDate = computed(() =>
:assignment="props.assignment" :assignment="props.assignment"
:assignment-completion="props.assignmentCompletion" :assignment-completion="props.assignmentCompletion"
:due-date="dueDate" :due-date="dueDate"
@edit-task="editTask($event)"
></EvaluationSummary> ></EvaluationSummary>
</section> </section>
</div> </div>
<nav class="sticky bottom-0 border-t bg-gray-200 p-6" v-if="state.pageIndex > 0"> <nav
class="sticky bottom-0 border-t bg-gray-200 p-6"
v-if="state.pageIndex > 0 && !evaluationSubmitted"
>
<div class="relative flex flex-row place-content-end"> <div class="relative flex flex-row place-content-end">
<button <button
v-if="true" v-if="true"

View File

@ -52,11 +52,22 @@ async function startEvaluation() {
<p class="my-4"> <p class="my-4">
Die Gesamtpunktzahl und die daruas resultierende Note wird auf Grund des Die Gesamtpunktzahl und die daruas resultierende Note wird auf Grund des
hinterlegeten Beurteilungsinstrument berechnet. Willst du mehr dazu erfahren: hinterlegeten Beurteilungsinstrument berechnet.
</p> </p>
<p class="my-4">TODO: Link zu Bewertungskriterium</p>
<div> <div>
<button class="btn-primary" @click="startEvaluation()">Bewertung starten</button> <button class="btn-primary" @click="startEvaluation()">
<span
v-if="
props.assignmentCompletion.completion_status === 'evaluation_in_progress'
"
>
Bewertung fortsetzen
</span>
<span v-else>Bewertung starten</span>
</button>
</div> </div>
</div> </div>
</template> </template>

View File

@ -1,4 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import ItSuccessAlert from "@/components/ui/ItSuccessAlert.vue";
import { import {
maxAssignmentPoints, maxAssignmentPoints,
pointsToGrade, pointsToGrade,
@ -8,9 +9,9 @@ import { useAssignmentStore } from "@/stores/assignmentStore";
import { useCourseSessionsStore } from "@/stores/courseSessions"; import { useCourseSessionsStore } from "@/stores/courseSessions";
import type { Assignment, AssignmentEvaluationTask, CourseSessionUser } from "@/types"; import type { Assignment, AssignmentEvaluationTask, CourseSessionUser } from "@/types";
import { AssignmentCompletion } from "@/types"; import { AssignmentCompletion } from "@/types";
import { Dayjs } from "dayjs"; import dayjs, { Dayjs } from "dayjs";
import * as log from "loglevel"; import * as log from "loglevel";
import { computed } from "vue"; import { computed, reactive } from "vue";
const props = defineProps<{ const props = defineProps<{
assignmentUser: CourseSessionUser; assignmentUser: CourseSessionUser;
@ -21,6 +22,10 @@ const props = defineProps<{
const emit = defineEmits(["submitEvaluation", "editTask"]); const emit = defineEmits(["submitEvaluation", "editTask"]);
const state = reactive({
showSuccessInfo: false,
});
log.debug("EvaluationSummary setup"); log.debug("EvaluationSummary setup");
const courseSessionStore = useCourseSessionsStore(); const courseSessionStore = useCourseSessionsStore();
@ -37,7 +42,7 @@ async function submitEvaluation() {
evaluation_grade: grade.value, evaluation_grade: grade.value,
evaluation_points: userPoints.value, evaluation_points: userPoints.value,
}); });
emit("submitEvaluation"); state.showSuccessInfo = true;
} }
function subTaskByPoints(task: AssignmentEvaluationTask, points = 0) { function subTaskByPoints(task: AssignmentEvaluationTask, points = 0) {
@ -65,7 +70,7 @@ const grade = computed(() => pointsToGrade(userPoints.value, maxPoints.value));
<template> <template>
<div> <div>
<h3>Bewertung Freigabe</h3> <h3 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>
@ -76,11 +81,28 @@ const grade = computed(() => pointsToGrade(userPoints.value, maxPoints.value));
hinterlegeten Beurteilungsinstrument berechnet. Willst du mehr dazu erfahren: hinterlegeten Beurteilungsinstrument berechnet. Willst du mehr dazu erfahren:
</p> </p>
<div> <div
v-if="props.assignmentCompletion.completion_status === 'evaluation_submitted'"
>
Freigabetermin:
{{
dayjs(props.assignmentCompletion.evaluation_submitted_at).format("DD.MM.YYYY")
}}
um
{{ dayjs(props.assignmentCompletion.evaluation_submitted_at).format("HH.mm") }}
Uhr
</div>
<div v-else>
<button class="btn-primary" @click="submitEvaluation()"> <button class="btn-primary" @click="submitEvaluation()">
Bewertung freigeben Bewertung freigeben
</button> </button>
</div> </div>
<div class="mt-4" v-if="state.showSuccessInfo">
<ItSuccessAlert
:text="`Deine Bewertung für ${props.assignmentUser.first_name} ${props.assignmentUser.last_name} wurde freigegeben.`"
></ItSuccessAlert>
</div>
</section> </section>
<section> <section>
@ -90,7 +112,11 @@ const grade = computed(() => pointsToGrade(userPoints.value, maxPoints.value));
<div class="mb-4"> <div class="mb-4">
Bewertungskriterium {{ index + 1 }}: {{ task.value.title }} Bewertungskriterium {{ index + 1 }}: {{ task.value.title }}
</div> </div>
<div> <div
v-if="
props.assignmentCompletion.completion_status !== 'evaluation_submitted'
"
>
<button <button
class="link pl-2text-sm whitespace-nowrap" class="link pl-2text-sm whitespace-nowrap"
@click="emit('editTask', task)" @click="emit('editTask', task)"