diff --git a/client/src/components/dashboard/CoursePanel.vue b/client/src/components/dashboard/CoursePanel.vue index 26c04b7d..a65c26df 100644 --- a/client/src/components/dashboard/CoursePanel.vue +++ b/client/src/components/dashboard/CoursePanel.vue @@ -7,7 +7,7 @@ import AssignmentSummary from "@/components/dashboard/AssignmentSummary.vue"; import MentorOpenTasksCount from "@/components/dashboard/MentorOpenTasksCount.vue"; import MentorMenteeCount from "@/components/dashboard/MentorMenteeCount.vue"; import MentorCompetenceSummary from "@/components/dashboard/MentorCompetenceSummary.vue"; -import { getLearningPathUrl } from "@/utils/utils"; +import { getCockpitUrl, getLearningMentorUrl, getLearningPathUrl } from "@/utils/utils"; import UkStatistics from "@/components/dashboard/UkStatistics.vue"; const mentorWidgets = [ @@ -50,15 +50,21 @@ const actionButtonProps = computed<{ href: string; text: string; cyKey: string } }; } else if (props.courseConfig?.role_key === "Expert") { return { - href: "expertlink", + href: getCockpitUrl(props.courseConfig?.course_slug), text: "Cockpit anschauen", - cyKey: "", + cyKey: "cockpit-dashboard-link", }; } else if (props.courseConfig?.role_key === "Supervisor") { return { - href: "supervisorlink", + href: getCockpitUrl(props.courseConfig?.course_slug), text: "Cockpit anschauen", - cyKey: "Cockpit anschauen", + cyKey: "cockpit-dashboard-link", + }; + } else if (props.courseConfig?.role_key === "MentorVV") { + return { + href: getLearningMentorUrl(props.courseConfig?.course_slug), + text: "a.Übersicht anschauen", + cyKey: "lm-dashboard-link", }; } return { @@ -86,7 +92,7 @@ function hasActionButton(): boolean { class="btn-blue" :data-cy="actionButtonProps.cyKey" > - {{ actionButtonProps.text }} + {{ $t(actionButtonProps.text) }}
diff --git a/cypress/e2e/dashboard/dashboardSupervisor.cy.js b/cypress/e2e/dashboard/dashboardSupervisor.cy.js index aca8b793..ff7aeb20 100644 --- a/cypress/e2e/dashboard/dashboardSupervisor.cy.js +++ b/cypress/e2e/dashboard/dashboardSupervisor.cy.js @@ -63,14 +63,6 @@ describe("dashboardSupervisor.cy.js", () => { }); }); - describe("overall summary box", () => { - it("contains correct numbers (members, experts etc.)", () => { - getDashboardStatistics("participant.count").should("have.text", "4"); - getDashboardStatistics("expert.count").should("have.text", "2"); - getDashboardStatistics("session.count").should("have.text", "2"); - }); - }); - describe("feedback summary box", () => { it("contains correct numbers", () => { getDashboardStatistics("feedback.average").should("have.text", "3.3"); diff --git a/cypress/e2e/learning_mentor/constants.js b/cypress/e2e/learning_mentor/constants.js index b62aaa6a..4c52e97c 100644 --- a/cypress/e2e/learning_mentor/constants.js +++ b/cypress/e2e/learning_mentor/constants.js @@ -1,4 +1,4 @@ -export const MENTOR_OVERVIEW_URL = +export const MENTOR_TASKS_URL = "/course/versicherungsvermittler-in/learning-mentor/tasks"; export const MENTOR_MENTEES_URL = "/course/versicherungsvermittler-in/learning-mentor"; diff --git a/cypress/e2e/learning_mentor/overview/memberOnly.cy.js b/cypress/e2e/learning_mentor/overview/memberOnly.cy.js index 4a65389c..342657ef 100644 --- a/cypress/e2e/learning_mentor/overview/memberOnly.cy.js +++ b/cypress/e2e/learning_mentor/overview/memberOnly.cy.js @@ -1,4 +1,4 @@ -import {login} from "../../helpers"; +import { login } from "../../helpers"; import { MEMBER_DASHBOARD_LINK, MENTEE_MENTOR_LIST_ITEM, @@ -8,7 +8,7 @@ import { MENTOR_MY_MENTEES, MENTOR_MY_MENTORS, MENTOR_OVERVIEW_NAVIGATION_LINK, - MENTOR_OVERVIEW_URL + MENTOR_TASKS_URL, } from "../constants"; describe("memberOnly.cy.js", () => { @@ -23,14 +23,14 @@ describe("memberOnly.cy.js", () => { }); it("shows NO mentees navigation link", () => { - cy.visit(MENTOR_OVERVIEW_URL); + cy.visit(MENTOR_TASKS_URL); cy.get(MENTOR_MENTEES_NAVIGATION_LINK).should("not.exist"); - }) + }); it("shows NO overview navigation link", () => { - cy.visit(MENTOR_OVERVIEW_URL); + cy.visit(MENTOR_TASKS_URL); cy.get(MENTOR_OVERVIEW_NAVIGATION_LINK).should("not.exist"); - }) + }); it("shows NO mentees", () => { cy.visit(MENTOR_MENTEES_URL); @@ -54,5 +54,5 @@ describe("memberOnly.cy.js", () => { // then cy.contains(MENTOR_MY_MENTORS, mentor).should("not.exist"); - }) + }); }); diff --git a/cypress/e2e/learning_mentor/overview/mentorAndMember.cy.js b/cypress/e2e/learning_mentor/overview/mentorAndMember.cy.js index b7e1accb..9feef47f 100644 --- a/cypress/e2e/learning_mentor/overview/mentorAndMember.cy.js +++ b/cypress/e2e/learning_mentor/overview/mentorAndMember.cy.js @@ -1,4 +1,4 @@ -import {login} from "../../helpers"; +import { login } from "../../helpers"; import { MEMBER_DASHBOARD_LINK, MENTEE_MENTOR_LIST_ITEM, @@ -12,7 +12,7 @@ import { MENTOR_MY_MENTEES, MENTOR_MY_MENTORS, MENTOR_OVERVIEW_NAVIGATION_LINK, - MENTOR_OVERVIEW_URL + MENTOR_TASKS_URL, } from "../constants"; describe("mentorAndMember.cy.js", () => { @@ -27,21 +27,21 @@ describe("mentorAndMember.cy.js", () => { }); it("shows the learning mentor navigation", () => { - cy.visit(MENTOR_OVERVIEW_URL); + cy.visit(MENTOR_TASKS_URL); cy.get(MENTOR_MAIN_NAVIGATION).should("exist"); }); it("shows the mentees navigation link", () => { - cy.visit(MENTOR_OVERVIEW_URL); + cy.visit(MENTOR_TASKS_URL); cy.get(MENTOR_MENTEES_NAVIGATION_LINK).click(); cy.url().should("include", MENTOR_MENTEES_URL); - }) + }); it("shows the overview navigation link", () => { - cy.visit(MENTOR_OVERVIEW_URL); + cy.visit(MENTOR_TASKS_URL); cy.get(MENTOR_OVERVIEW_NAVIGATION_LINK).click(); - cy.url().should("include", MENTOR_OVERVIEW_URL); - }) + cy.url().should("include", MENTOR_TASKS_URL); + }); it("shows my mentees", () => { cy.visit(MENTOR_MENTEES_URL); @@ -69,10 +69,11 @@ describe("mentorAndMember.cy.js", () => { .click(); // then - const expectedMenteeProfileUrl = "/course/versicherungsvermittler-in/profile/5ff59857-8de5-415e-a387-4449f9a0337a" + const expectedMenteeProfileUrl = + "/course/versicherungsvermittler-in/profile/5ff59857-8de5-415e-a387-4449f9a0337a"; cy.url().should("include", expectedMenteeProfileUrl); cy.contains(mentee).should("exist"); - }) + }); it("can remove a mentee", () => { // given @@ -86,14 +87,16 @@ describe("mentorAndMember.cy.js", () => { // then cy.contains(MENTOR_MENTEE_LIST_ITEM, mentee).should("not.exist"); - cy.contains("Aktuell begleitest du niemanden als Lernbegleitung").should("exist"); - }) + cy.contains("Aktuell begleitest du niemanden als Lernbegleitung").should( + "exist" + ); + }); it("shows the correct mentors", () => { const mentor = "Micheala Weber-Mentor"; cy.visit(MENTOR_MENTEES_URL); cy.get(MENTOR_MY_MENTORS).should("contain", mentor); - }) + }); it("can remove a mentor", () => { // given @@ -107,6 +110,8 @@ describe("mentorAndMember.cy.js", () => { // then cy.contains(MENTOR_MY_MENTORS, mentor).should("not.exist"); - cy.contains("Aktuell hast du noch keine Person als Lernbegleitung eingeladen").should("exist"); - }) + cy.contains( + "Aktuell hast du noch keine Person als Lernbegleitung eingeladen" + ).should("exist"); + }); }); diff --git a/cypress/e2e/learning_mentor/overview/mentorOnly.cy.js b/cypress/e2e/learning_mentor/overview/mentorOnly.cy.js index d0d700ce..1bd55385 100644 --- a/cypress/e2e/learning_mentor/overview/mentorOnly.cy.js +++ b/cypress/e2e/learning_mentor/overview/mentorOnly.cy.js @@ -1,4 +1,4 @@ -import {login} from "../../helpers"; +import { login } from "../../helpers"; import { MENTOR_DASHBOARD_LINK, MENTOR_MAIN_NAVIGATION, @@ -10,7 +10,7 @@ import { MENTOR_MY_MENTEES, MENTOR_MY_MENTORS, MENTOR_OVERVIEW_NAVIGATION_LINK, - MENTOR_OVERVIEW_URL + MENTOR_TASKS_URL, } from "../constants"; describe("mentorOnly.cy.js", () => { @@ -22,25 +22,25 @@ describe("mentorOnly.cy.js", () => { it("shows the correct dashboard", () => { cy.visit("/"); cy.get(MENTOR_DASHBOARD_LINK).click(); - cy.url().should("include", MENTOR_OVERVIEW_URL); + cy.url().should("include", MENTOR_MENTEES_URL); }); it("shows the learning mentor navigation", () => { - cy.visit(MENTOR_OVERVIEW_URL); + cy.visit(MENTOR_MENTEES_URL); cy.get(MENTOR_MAIN_NAVIGATION).should("exist"); }); it("shows the mentees navigation link", () => { - cy.visit(MENTOR_OVERVIEW_URL); + cy.visit(MENTOR_TASKS_URL); cy.get(MENTOR_MENTEES_NAVIGATION_LINK).click(); cy.url().should("include", MENTOR_MENTEES_URL); - }) + }); it("shows the overview navigation link", () => { - cy.visit(MENTOR_OVERVIEW_URL); + cy.visit(MENTOR_TASKS_URL); cy.get(MENTOR_OVERVIEW_NAVIGATION_LINK).click(); - cy.url().should("include", MENTOR_OVERVIEW_URL); - }) + cy.url().should("include", MENTOR_TASKS_URL); + }); it("shows my mentees", () => { cy.visit(MENTOR_MENTEES_URL); @@ -69,10 +69,11 @@ describe("mentorOnly.cy.js", () => { .click(); // then - const expectedMenteeProfileUrl = "/course/versicherungsvermittler-in/profile/5ff59857-8de5-415e-a387-4449f9a0337a" + const expectedMenteeProfileUrl = + "/course/versicherungsvermittler-in/profile/5ff59857-8de5-415e-a387-4449f9a0337a"; cy.url().should("include", expectedMenteeProfileUrl); cy.contains(mentee).should("exist"); - }) + }); it("can remove a mentee", () => { // given @@ -86,6 +87,8 @@ describe("mentorOnly.cy.js", () => { // then cy.contains(MENTOR_MENTEE_LIST_ITEM, mentee).should("not.exist"); - cy.contains(MENTOR_MENTEE_LIST_ITEM, "Robert Student-plus-Mentor").should("exist") - }) + cy.contains(MENTOR_MENTEE_LIST_ITEM, "Robert Student-plus-Mentor").should( + "exist" + ); + }); }); diff --git a/server/vbv_lernwelt/course/creators/test_course.py b/server/vbv_lernwelt/course/creators/test_course.py index 124f4146..2c30840a 100644 --- a/server/vbv_lernwelt/course/creators/test_course.py +++ b/server/vbv_lernwelt/course/creators/test_course.py @@ -47,6 +47,7 @@ from vbv_lernwelt.course.factories import CoursePageFactory from vbv_lernwelt.course.models import ( Course, CourseCategory, + CourseConfiguration, CoursePage, CourseSession, CourseSessionUser, @@ -109,7 +110,6 @@ def create_test_course( course: Course = create_test_course_with_categories() course.configuration.enable_learning_mentor = False - course.configuration.save() competence_certificate = create_test_competence_navi() @@ -133,9 +133,13 @@ def create_test_course( title="Edoniq Wissens- und Verständisfragen - Circle Fahrzeug (Demo)", competence_certificate=competence_certificate, ) + course.configuration.is_uk = True if include_vv: create_vv_gewinnen_casework(course_id=COURSE_TEST_ID) + course.configuration.is_vv = True + + course.configuration.save() create_test_learning_path( include_uk=include_uk, include_vv=include_vv, with_documents=with_documents @@ -422,6 +426,10 @@ def create_test_course_with_categories(apps=None, schema_editor=None): course.slug = course_page.slug course.save() + config = CourseConfiguration.objects.get_or_create(course=course)[0] + config.is_uk = True + config.save() + return course diff --git a/server/vbv_lernwelt/course/management/commands/create_default_courses.py b/server/vbv_lernwelt/course/management/commands/create_default_courses.py index 0ba564a4..2798f21e 100644 --- a/server/vbv_lernwelt/course/management/commands/create_default_courses.py +++ b/server/vbv_lernwelt/course/management/commands/create_default_courses.py @@ -207,6 +207,8 @@ def create_versicherungsvermittlerin_course( course_id=course_id, title=names[language], ) + course.configuration.is_vv = True + course.configuration.save() # assignments create assignments parent page _assignment_list_page = AssignmentListPageFactory( @@ -354,6 +356,8 @@ def create_course_uk_de(course_id=COURSE_UK, lang="de"): "it": "Corsi interaziendali", } course = create_course_with_categories(course_id=course_id, title=names[lang]) + course.configuration.is_uk = True + course.configuration.save() # assignments create assignments parent page _assignment_list_page = AssignmentListPageFactory( @@ -387,6 +391,8 @@ def create_course_uk_de(course_id=COURSE_UK, lang="de"): def create_course_uk_de_course_sessions(): course = Course.objects.get(id=COURSE_UK) + course.configuration.is_uk = True + course.configuration.save() cs = CourseSession.objects.create( course_id=COURSE_UK, @@ -500,6 +506,8 @@ def create_course_uk_fr(): course = create_course_with_categories( course_id=COURSE_UK_FR, title="Cours interentreprises" ) + course.configuration.is_uk = True + course.configuration.save() # assignments create assignments parent page _assignment_list_page = AssignmentListPageFactory( @@ -550,6 +558,8 @@ def create_course_uk_it(): course = create_course_with_categories( course_id=COURSE_UK_IT, title="Corso interaziendale" ) + course.configuration.is_uk = True + course.configuration.save() # assignments create assignments parent page _assignment_list_page = AssignmentListPageFactory( @@ -651,6 +661,8 @@ def create_course_training_de(): course = create_course_with_categories( course_id=COURSE_UK_TRAINING, title="myVBV Training" ) + course.configuration.is_uk = True + course.configuration.save() # assignments create assignments parent page _assignment_list_page = AssignmentListPageFactory( @@ -741,6 +753,8 @@ def create_course_training_fr(): course = create_course_with_categories( course_id=COURSE_UK_TRAINING_FR, title="myVBV Training (FR)" ) + course.configuration.is_uk = True + course.configuration.save() # assignments create assignments parent page _assignment_list_page = AssignmentListPageFactory( @@ -828,6 +842,8 @@ def create_course_training_it(): course = create_course_with_categories( course_id=COURSE_UK_TRAINING_IT, title="myVBV Training (IT)" ) + course.configuration.is_uk = True + course.configuration.save() # assignments create assignments parent page _assignment_list_page = AssignmentListPageFactory( diff --git a/server/vbv_lernwelt/dashboard/graphql/queries.py b/server/vbv_lernwelt/dashboard/graphql/queries.py index ce87845f..ad780b42 100644 --- a/server/vbv_lernwelt/dashboard/graphql/queries.py +++ b/server/vbv_lernwelt/dashboard/graphql/queries.py @@ -66,6 +66,10 @@ class DashboardQuery(graphene.ObjectType): expert__user=user, expert__role=CourseSessionUser.Role.EXPERT ).values_list("id", flat=True) ) + + if not circle_ids: + return None + course_session_ids = CourseSession.objects.filter( course=course, coursesessionuser__user=user, @@ -75,8 +79,6 @@ class DashboardQuery(graphene.ObjectType): # todo: if course_session_ids and circles are empty return none or 404 or 401 - # return None - return CourseStatisticsType( _id=course.id, # noqa course_id=course.id, # noqa diff --git a/server/vbv_lernwelt/dashboard/views.py b/server/vbv_lernwelt/dashboard/views.py index 82caa025..fb68f6ce 100644 --- a/server/vbv_lernwelt/dashboard/views.py +++ b/server/vbv_lernwelt/dashboard/views.py @@ -247,10 +247,10 @@ def get_widgets_for_course( if is_mentor: widgets.append(WidgetType.MENTOR_PERSON_WIDGET.value) - if is_vv: - widgets.append(WidgetType.MENTOR_TASKS_WIDGET.value) if is_uk: widgets.append(WidgetType.MENTOR_COMPETENCE_WIDGET.value) + if is_vv: + widgets.append(WidgetType.MENTOR_TASKS_WIDGET.value) return widgets