Merged in fix/evaluation-text (pull request #323)

Fix/evaluation text
This commit is contained in:
Christian Cueni 2024-05-02 14:38:36 +00:00
commit dd68da5138
6 changed files with 37 additions and 12 deletions

View File

@ -5,6 +5,7 @@ import SmileyCell from "@/components/selfEvaluationFeedback/SmileyCell.vue";
const props = defineProps<{
summary: LearningUnitSummary;
hideDetailLink?: boolean;
}>();
const hasFeedbackReceived = computed(() => {
@ -34,6 +35,7 @@ const feedbackProviderName = computed(() => {
</div>
<span class="pl-4 underline">
<router-link
v-if="!props.hideDetailLink"
:to="props.summary.detail_url"
:data-cy="`self-eval-${summary.id}-detail-url`"
>

View File

@ -1,22 +1,23 @@
<script setup lang="ts">
import { useSelfEvaluationFeedbackSummaries } from "@/services/selfEvaluationFeedback";
import { useCurrentCourseSession } from "@/composables";
import { useCurrentCourseSession, useEvaluationWithFeedback } from "@/composables";
import { computed, ref } from "vue";
import FeedbackByLearningUnitSummary from "@/components/selfEvaluationFeedback/FeedbackByLearningUnitSummary.vue";
import ItDropdownSelect from "@/components/ui/ItDropdownSelect.vue";
import { t } from "i18next";
import { useUserStore } from "@/stores/user";
const props = defineProps<{
profileUserId: string;
}>();
const userStore = useUserStore();
const courseSession = useCurrentCourseSession();
const selfEvaluationFeedbackSummaries = useSelfEvaluationFeedbackSummaries(
courseSession.value.id,
props.profileUserId
);
const course = computed(() => courseSession.value.course);
const isLoaded = computed(() => !selfEvaluationFeedbackSummaries.loading.value);
const selectedCircle = ref({ name: t("a.AlleCircle"), id: "_all" });
@ -37,13 +38,19 @@ const summaries = computed(() => {
);
});
const hasEvaluationFeedback = useEvaluationWithFeedback().hasFeedback;
const headerTitle = computed(() => {
if (course.value.configuration.enable_learning_mentor) {
if (hasEvaluationFeedback.value) {
return t("a.Selbst- und Fremdeinschätzungen");
} else {
return t("a.Selbsteinschätzungen");
}
});
const isOwnEvaluation = computed(() => {
return props.profileUserId === userStore.id;
});
</script>
<template>
@ -63,6 +70,7 @@ const headerTitle = computed(() => {
v-for="summary in summaries"
:key="summary.id"
:summary="summary"
:hide-detail-link="!isOwnEvaluation"
/>
</div>
</div>

View File

@ -717,3 +717,14 @@ export function useCertificateQuery(userId: string | undefined, courseSlug: stri
return { certificatesQuery };
}
export function useEvaluationWithFeedback() {
const currentCourseSession = useCurrentCourseSession();
const hasFeedback = computed(
() =>
currentCourseSession.value.course.configuration.enable_learning_mentor &&
!currentCourseSession.value.course.configuration.is_uk
);
return { hasFeedback };
}

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import log from "loglevel";
import { computed, onMounted } from "vue";
import { computed } from "vue";
import type { CompetenceCertificate } from "@/types";
import { useCertificateQuery } from "@/composables";
import CompetenceCertificateComponent from "@/pages/competence/CompetenceCertificateComponent.vue";
@ -34,10 +34,6 @@ const certificate = computed(() => {
(certificates.competence_certificates as unknown as CompetenceCertificate[]) ?? []
).find((cc) => cc.slug.endsWith(props.certificateSlug));
});
onMounted(async () => {
// log.debug("AssignmentView mounted", props.assignmentId, props.userId);
});
</script>
<template>

View File

@ -2,7 +2,7 @@
import * as log from "loglevel";
import { onMounted } from "vue";
import { useRoute } from "vue-router";
import { useCurrentCourseSession } from "@/composables";
import { useCurrentCourseSession, useEvaluationWithFeedback } from "@/composables";
log.debug("CompetenceParentPage created");
@ -29,6 +29,7 @@ function routeInSelfEvaluationAndFeedback() {
}
const currentCourseSession = useCurrentCourseSession();
const hasEvaluationFeedback = useEvaluationWithFeedback().hasFeedback;
onMounted(async () => {
log.debug("CompetenceParentPage mounted", props.courseSlug);
@ -72,7 +73,7 @@ onMounted(async () => {
class="block py-3"
>
{{
currentCourseSession.course.configuration.enable_learning_mentor
hasEvaluationFeedback
? $t("a.Selbst- und Fremdeinschätzungen")
: $t("a.Selbsteinschätzungen")
}}

View File

@ -63,8 +63,15 @@ const showDocumentSection = computed(() => {
);
});
const expertAsContact = computed(() => {
return (
lpQueryResult.course.value?.configuration.enable_learning_mentor &&
lpQueryResult.course.value?.configuration.is_vv
);
});
const courseConfig = computed(() => {
if (lpQueryResult.course.value?.configuration.enable_learning_mentor) {
if (expertAsContact.value) {
return {
contactDescription: "circlePage.contactLearningMentorDescription",
contactButton: "circlePage.contactLearningMentorButton",
@ -98,7 +105,7 @@ interface Mentor {
const experts = computed<Expert[] | null>(() => {
if (courseConfig.value.showContact) {
if (lpQueryResult.course.value?.configuration.enable_learning_mentor) {
if (expertAsContact.value) {
if (mentors.value?.length > 0) {
return mentors.value.map((m: Mentor) => m.mentor);
}