Merged in fix/naming (pull request #327)

Hide Fremdeinschätzung in a users profile if in uk course
This commit is contained in:
Christian Cueni 2024-05-06 11:59:52 +00:00
commit ca25f522fa
7 changed files with 117 additions and 65 deletions

View File

@ -1,7 +1,7 @@
<script setup lang="ts">
import { computed } from "vue";
import { useSelfEvaluationFeedbackSummaries } from "@/services/selfEvaluationFeedback";
import { useCurrentCourseSession } from "@/composables";
import { useCurrentCourseSession, useEvaluationWithFeedback } from "@/composables";
const emit = defineEmits(["showAll"]);
@ -9,8 +9,6 @@ const props = defineProps<{
profileUserId: string;
}>();
const courseSession = useCurrentCourseSession();
const selfEvaluationFeedbackSummaries = useSelfEvaluationFeedbackSummaries(
useCurrentCourseSession().value.id,
props.profileUserId
@ -31,7 +29,10 @@ const isLoaded = computed(() => !selfEvaluationFeedbackSummaries.loading.value);
<div>
<template v-if="isLoaded">
<!-- Self Evaluation -->
<div class="bg-white px-8 py-4 lg:mb-8 lg:py-8">
<div
class="bg-white px-8 py-4 lg:mb-8 lg:py-8"
data-cy="evaluation-overview-selfevaluation-block"
>
<div class="mb-8">
<h3 class="mb-4 pb-4 lg:pb-0">
{{ $t("a.Selbsteinschätzungen") }}
@ -79,8 +80,9 @@ const isLoaded = computed(() => !selfEvaluationFeedbackSummaries.loading.value);
</div>
<!-- Feedback Evaluation -->
<div
v-if="courseSession.course.configuration.enable_learning_mentor"
v-if="useEvaluationWithFeedback().hasFeedback.value"
class="border-t pt-8"
data-cy="evaluation-overview-feedback-block"
>
<h3 class="mb-4 pb-4 lg:pb-0">
{{ $t("a.Fremdeinschätzungen") }}

View File

@ -723,7 +723,7 @@ export function useEvaluationWithFeedback() {
const hasFeedback = computed(
() =>
currentCourseSession.value.course.configuration.enable_learning_mentor &&
!currentCourseSession.value.course.configuration.is_uk
currentCourseSession.value.course.configuration.is_vv
);
return { hasFeedback };

View File

@ -377,6 +377,7 @@ watch(selectedRegion, () => {
},
query: { courseSessionId: cs.id },
}"
data-cy="person-learning-path-link"
class="link w-full lg:text-right"
>
{{ $t("a.Profil anzeigen") }}

View File

@ -68,7 +68,7 @@ onMounted(() => {
: '',
]"
>
<router-link :to="{ name: page.route }">
<router-link :to="{ name: page.route }" :data-cy="page.routeMatch">
{{ page.label }}
</router-link>
</li>

View File

@ -4,12 +4,17 @@ describe("courseSpecificSettings.cy.js", () => {
describe("uk Course", () => {
beforeEach(() => {
cy.manageCommand("cypress_reset --set-only-is-uk-flag");
});
describe("as member", () => {
beforeEach(() => {
login("test-student1@example.com", "test");
});
it("should display 'Selbsteinschätzung in üK'", () => {
cy.visit("/course/test-lehrgang/competence/self-evaluation-and-feedback");
cy.visit(
"/course/test-lehrgang/competence/self-evaluation-and-feedback"
);
cy.get('[data-cy="self-evaluation-title"]').contains(
"Selbsteinschätzung",
{ matchCase: false, exact: true }
@ -42,15 +47,41 @@ describe("courseSpecificSettings.cy.js", () => {
});
});
describe("as trainer", () => {
beforeEach(() => {
login("test-trainer1@example.com", "test");
});
it("should not display the feedback panel in public profile", () => {
cy.visit("/dashboard/persons");
cy.get('[data-cy="person-learning-path-link"]').first().click();
cy.get('[data-cy="profileCompetence"]').click();
cy.get('[data-cy="evaluation-overview-selfevaluation-block"]').should(
"exist"
);
cy.get('[data-cy="evaluation-overview-feedback-block"]').should(
"not.exist"
);
});
});
});
describe("VV course", () => {
beforeEach(() => {
cy.manageCommand("cypress_reset --set-only-is-vv-flag");
cy.manageCommand(
"cypress_reset --set-only-is-vv-flag --create-learning-mentor"
);
});
describe("as member", () => {
beforeEach(() => {
login("test-student1@example.com", "test");
});
it("should display 'Selbst- und Fremdeinschätzung in VV'", () => {
cy.visit("/course/test-lehrgang/competence/self-evaluation-and-feedback");
cy.visit(
"/course/test-lehrgang/competence/self-evaluation-and-feedback"
);
cy.get('[data-cy="self-evaluation-title"]').contains(
"Selbst- und Fremdeinschätzung",
{ matchCase: false, exact: true }
@ -82,4 +113,20 @@ describe("courseSpecificSettings.cy.js", () => {
);
});
});
});
describe("as mentor", () => {
beforeEach(() => {
login("test-mentor1@example.com", "test");
});
it("should display the feedback panel in public profile", () => {
cy.visit("/dashboard/persons");
cy.get('[data-cy="person-learning-path-link"]').first().click();
cy.get('[data-cy="profileCompetence"]').click();
cy.get('[data-cy="evaluation-overview-selfevaluation-block"]').should(
"exist"
);
cy.get('[data-cy="evaluation-overview-feedback-block"]').should("exist");
});
});
});

View File

@ -404,6 +404,7 @@ def command(
course = Course.objects.get(id=COURSE_TEST_ID)
course.configuration.enable_circle_documents = enable_circle_documents
course.configuration.is_uk = True
course.configuration.is_vv = True
if set_only_is_uk_flag or set_only_is_vv_flag:
if set_only_is_uk_flag:

View File

@ -22,6 +22,7 @@ class CourseConfigurationSerializer(serializers.ModelSerializer):
"enable_learning_mentor",
"enable_competence_certificates",
"is_uk",
"is_vv",
]