Hide Fremdeinschätzung in a users profile if in uk course

This commit is contained in:
Christian Cueni 2024-05-06 13:05:08 +02:00
parent 528aa4aef9
commit 1634943c21
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,82 +4,129 @@ describe("courseSpecificSettings.cy.js", () => {
describe("uk Course", () => {
beforeEach(() => {
cy.manageCommand("cypress_reset --set-only-is-uk-flag");
login("test-student1@example.com", "test");
});
it("should display 'Selbsteinschätzung in üK'", () => {
cy.visit("/course/test-lehrgang/competence/self-evaluation-and-feedback");
cy.get('[data-cy="self-evaluation-title"]').contains(
"Selbsteinschätzung",
{ matchCase: false, exact: true }
);
cy.get(
'[data-cy="self-evaluation-and-feedback-navigation-link"]'
).contains("Selbsteinschätzung", {
matchCase: false,
exact: true,
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.get('[data-cy="self-evaluation-title"]').contains(
"Selbsteinschätzung",
{ matchCase: false, exact: true }
);
cy.get(
'[data-cy="self-evaluation-and-feedback-navigation-link"]'
).contains("Selbsteinschätzung", {
matchCase: false,
exact: true,
});
});
it("should display 'Praxisbildner'", () => {
cy.visit("/course/test-lehrgang/learn");
cy.get('[data-cy="navigation-learning-mentor-link"]').contains(
"Praxisbildner"
);
cy.get('[data-cy="navigation-learning-mentor-link"]').click();
cy.get('[data-cy="lm-my-lms-title"]').contains("Meine Praxisbildner");
cy.get('[data-cy="lm-invite-mentor-button"]').contains(
"Neuen Praxisbildner einladen"
);
});
it("should display trainer in contact box", () => {
cy.visit("/course/test-lehrgang/learn/fahrzeug#ls-vorbereitung");
cy.get('[data-cy="circle-contact-description"]').contains(
"Tausche dich mit der Trainer/-in für den Circle Fahrzeug aus."
);
});
});
it("should display 'Praxisbildner'", () => {
cy.visit("/course/test-lehrgang/learn");
cy.get('[data-cy="navigation-learning-mentor-link"]').contains(
"Praxisbildner"
);
cy.get('[data-cy="navigation-learning-mentor-link"]').click();
cy.get('[data-cy="lm-my-lms-title"]').contains("Meine Praxisbildner");
cy.get('[data-cy="lm-invite-mentor-button"]').contains(
"Neuen Praxisbildner einladen"
);
});
describe("as trainer", () => {
beforeEach(() => {
login("test-trainer1@example.com", "test");
});
it("should display trainer in contact box", () => {
cy.visit("/course/test-lehrgang/learn/fahrzeug#ls-vorbereitung");
cy.get('[data-cy="circle-contact-description"]').contains(
"Tausche dich mit der Trainer/-in für den Circle Fahrzeug aus."
);
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");
login("test-student1@example.com", "test");
cy.manageCommand(
"cypress_reset --set-only-is-vv-flag --create-learning-mentor"
);
});
it("should display 'Selbst- und Fremdeinschätzung in VV'", () => {
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 }
);
cy.get(
'[data-cy="self-evaluation-and-feedback-navigation-link"]'
).contains("Selbst- und Fremdeinschätzung", {
matchCase: false,
exact: true,
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.get('[data-cy="self-evaluation-title"]').contains(
"Selbst- und Fremdeinschätzung",
{ matchCase: false, exact: true }
);
cy.get(
'[data-cy="self-evaluation-and-feedback-navigation-link"]'
).contains("Selbst- und Fremdeinschätzung", {
matchCase: false,
exact: true,
});
});
it("should display 'Lernbegleitung'", () => {
cy.visit("/course/test-lehrgang/learn");
cy.get('[data-cy="navigation-learning-mentor-link"]').contains(
"Lernbegleitung"
);
cy.get('[data-cy="navigation-learning-mentor-link"]').click();
cy.get('[data-cy="lm-my-lms-title"]').contains("Meine Lernbegleiter");
cy.get('[data-cy="lm-invite-mentor-button"]').contains(
"Neue Lernbegleitung einladen"
);
});
it("should display lernbegleitung in contact box", () => {
cy.visit("/course/test-lehrgang/learn/fahrzeug#ls-vorbereitung");
cy.get('[data-cy="circle-contact-description"]').contains(
"Tausche dich mit deiner Lernbegleitung aus."
);
});
});
it("should display 'Lernbegleitung'", () => {
cy.visit("/course/test-lehrgang/learn");
cy.get('[data-cy="navigation-learning-mentor-link"]').contains(
"Lernbegleitung"
);
cy.get('[data-cy="navigation-learning-mentor-link"]').click();
cy.get('[data-cy="lm-my-lms-title"]').contains("Meine Lernbegleiter");
cy.get('[data-cy="lm-invite-mentor-button"]').contains(
"Neue Lernbegleitung einladen"
);
});
describe("as mentor", () => {
beforeEach(() => {
login("test-mentor1@example.com", "test");
});
it("should display lernbegleitung in contact box", () => {
cy.visit("/course/test-lehrgang/learn/fahrzeug#ls-vorbereitung");
cy.get('[data-cy="circle-contact-description"]').contains(
"Tausche dich mit deiner Lernbegleitung aus."
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",
]