Switch course session on jump to assignment in circle
This commit is contained in:
parent
f70569f319
commit
51f71fb3f1
|
|
@ -337,7 +337,7 @@ const mentorTabTitle = computed(() =>
|
||||||
v-if="selectedCourseSessionTitle"
|
v-if="selectedCourseSessionTitle"
|
||||||
class="nav-item hidden items-center lg:inline-flex"
|
class="nav-item hidden items-center lg:inline-flex"
|
||||||
>
|
>
|
||||||
<div class="">
|
<div class="" data-cy="current-course-session-title">
|
||||||
{{ selectedCourseSessionTitle }}
|
{{ selectedCourseSessionTitle }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,15 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { CompetenceCertificateAssignment } from "@/types";
|
import { useCurrentCourseSession } from "@/composables";
|
||||||
|
import router from "@/router";
|
||||||
|
import { useCourseSessionsStore } from "@/stores/courseSessions";
|
||||||
|
import type { Assignment, CompetenceCertificateAssignment } from "@/types";
|
||||||
import * as log from "loglevel";
|
import * as log from "loglevel";
|
||||||
|
|
||||||
log.debug("CompetenceAssignmentRow setup");
|
log.debug("CompetenceAssignmentRow setup");
|
||||||
|
|
||||||
|
const currentCourseSession = useCurrentCourseSession();
|
||||||
|
const { switchCourseSessionById } = useCourseSessionsStore();
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
assignment: CompetenceCertificateAssignment;
|
assignment: CompetenceCertificateAssignment;
|
||||||
showCourseSession: boolean;
|
showCourseSession: boolean;
|
||||||
|
|
@ -20,6 +26,13 @@ const getIconName = () => {
|
||||||
}
|
}
|
||||||
return "it-icon-assignment-large";
|
return "it-icon-assignment-large";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const openInCircle = (assignment: CompetenceCertificateAssignment) => {
|
||||||
|
if (assignment.completion?.course_session !== currentCourseSession.value) {
|
||||||
|
switchCourseSessionById(assignment.completion!.course_session.id);
|
||||||
|
}
|
||||||
|
router.push(assignment.frontend_url);
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -38,9 +51,10 @@ const getIconName = () => {
|
||||||
{{ assignment?.completion?.course_session.title }}
|
{{ assignment?.completion?.course_session.title }}
|
||||||
</p>
|
</p>
|
||||||
<p class="text-gray-800">
|
<p class="text-gray-800">
|
||||||
<a
|
<button
|
||||||
v-if="assignment.learning_content"
|
v-if="assignment.learning_content"
|
||||||
:href="assignment.frontend_url"
|
:href="assignment.frontend_url"
|
||||||
|
@click="() => openInCircle(assignment)"
|
||||||
class="link"
|
class="link"
|
||||||
data-cy="open-learning-content"
|
data-cy="open-learning-content"
|
||||||
>
|
>
|
||||||
|
|
@ -49,7 +63,7 @@ const getIconName = () => {
|
||||||
x: assignment.learning_content.circle.title,
|
x: assignment.learning_content.circle.title,
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
</a>
|
</button>
|
||||||
<span v-else>Fehler, Lerninhalt nicht korrekt verknüpft</span>
|
<span v-else>Fehler, Lerninhalt nicht korrekt verknüpft</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -409,6 +409,7 @@ export interface CompetenceCertificateAssignment extends BaseCourseWagtailPage {
|
||||||
evaluation_max_points: number | null;
|
evaluation_max_points: number | null;
|
||||||
evaluation_passed: boolean | null;
|
evaluation_passed: boolean | null;
|
||||||
course_session: {
|
course_session: {
|
||||||
|
id: string;
|
||||||
title: string;
|
title: string;
|
||||||
};
|
};
|
||||||
} | null;
|
} | null;
|
||||||
|
|
|
||||||
|
|
@ -258,6 +258,25 @@ describe("competenceCertificate.cy.js", () => {
|
||||||
cy.get('[data-cy="assignment-test-lehrgang-assignment-edoniq-wissens-und-verständisfragen-circle-fahrzeug-demo-course-session"]').should("contain", "Test Zürich 2022 a")
|
cy.get('[data-cy="assignment-test-lehrgang-assignment-edoniq-wissens-und-verständisfragen-circle-fahrzeug-demo-course-session"]').should("contain", "Test Zürich 2022 a")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("check show assignment in different course session", () => {
|
||||||
|
const TEST_TRAINER2_USER_ID = "299941ae-1e4b-4f45-8180-876c3ad340b4"
|
||||||
|
const TEST_STUDENT2_USER_ID = "19c40d94-15cc-4198-aaad-ef707c4b0900"
|
||||||
|
const TEST_COURSE_SESSION_ZURICH_ID = -2
|
||||||
|
cy.manageCommand(
|
||||||
|
`cypress_reset --create-assignment-evaluation --assignment-evaluation-user-id ${TEST_TRAINER2_USER_ID} --assignment-completion-user-id ${TEST_STUDENT2_USER_ID} --edoniq-user-id ${TEST_STUDENT2_USER_ID} --edoniq-course-session-id '${TEST_COURSE_SESSION_ZURICH_ID}' --create-edoniq-test-results 19 24 0`
|
||||||
|
)
|
||||||
|
login("test-student2@example.com", "test")
|
||||||
|
cy.visit("course/test-lehrgang/competence/certificates/kompetenznachweis-1")
|
||||||
|
|
||||||
|
cy.get('[data-cy="current-course-session-title"]').should("contain", "Test Bern 2022 a")
|
||||||
|
|
||||||
|
cy.get(
|
||||||
|
'[data-cy="assignment-test-lehrgang-assignment-edoniq-wissens-und-verständisfragen-circle-fahrzeug-demo"] [data-cy="open-learning-content"]'
|
||||||
|
).click()
|
||||||
|
|
||||||
|
cy.get('[data-cy="current-course-session-title"]').should("contain", "Test Zürich 2022 a")
|
||||||
|
})
|
||||||
|
|
||||||
it("check with finished edoniq test with deducted points", () => {
|
it("check with finished edoniq test with deducted points", () => {
|
||||||
cy.manageCommand(
|
cy.manageCommand(
|
||||||
"cypress_reset --create-assignment-completion --create-edoniq-test-results 19 24 8"
|
"cypress_reset --create-assignment-completion --create-edoniq-test-results 19 24 8"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue