diff --git a/client/src/pages/learningPath/circlePage/CirclePage.vue b/client/src/pages/learningPath/circlePage/CirclePage.vue
index 5c84fdda..00bc318c 100644
--- a/client/src/pages/learningPath/circlePage/CirclePage.vue
+++ b/client/src/pages/learningPath/circlePage/CirclePage.vue
@@ -63,8 +63,8 @@ const showDuration = computed(() => {
return false;
});
-const show_document_section = computed(() => {
- return lpQueryResult.course.value.enable_circle_documents && !props.readonly;
+const showDocumentSection = computed(() => {
+ return lpQueryResult.course.value?.enable_circle_documents && !props.readonly;
});
watch(
@@ -193,7 +193,7 @@ watch(
{{ $t("circlePage.learnMore") }}
-
+
{{ $t("circlePage.gotQuestions") }}
diff --git a/cypress/e2e/settings.cy.js b/cypress/e2e/settings.cy.js
new file mode 100644
index 00000000..6c3947c2
--- /dev/null
+++ b/cypress/e2e/settings.cy.js
@@ -0,0 +1,40 @@
+import { login } from "./helpers";
+
+describe("settings.cy.js", () => {
+ beforeEach(() => {
+ cy.manageCommand("cypress_reset");
+ });
+
+ describe("with circle documents enabled", () => {
+ it("student can see circle documents", () => {
+ login("test-student1@example.com", "test");
+ cy.visit("/course/test-lehrgang/learn/fahrzeug");
+ cy.get('[data-cy="circle-document-section"]').should("exist");
+ });
+
+ it("trainer can see circle documents", () => {
+ login("test-trainer1@example.com", "test");
+ cy.visit("/course/test-lehrgang/cockpit");
+ cy.get('[data-cy="circle-documents"]').should("exist");
+ });
+ });
+
+ describe("with circle documents disabled", () => {
+ beforeEach(() => {
+ cy.manageCommand("cypress_reset --no-enable-circle-documents");
+ });
+
+ it("student cannot see circle documents", () => {
+ login("test-student1@example.com", "test");
+ cy.visit("/course/test-lehrgang/learn/fahrzeug");
+ cy.get('[data-cy="circle-title"]').should("contain", "Fahrzeug");
+ cy.get('[data-cy="circle-document-section"]').should("not.exist");
+ });
+
+ it("trainer cannot see circle documents", () => {
+ login("test-trainer1@example.com", "test");
+ cy.visit("/course/test-lehrgang/cockpit");
+ cy.get('[data-cy="circle-documents"]').should("not.exist");
+ });
+ });
+});
diff --git a/cypress/support/commands.js b/cypress/support/commands.js
index e66cc567..0ba844c0 100644
--- a/cypress/support/commands.js
+++ b/cypress/support/commands.js
@@ -60,6 +60,7 @@ Cypress.Commands.add("manageCommand", (command, preCommand = "") => {
let pythonPaths = [
"/Users/daniel/workspace/vbv_lernwelt/.direnv/python-3.10.6/bin",
"/Users/eliabieri/iterativ/vbv_lernwelt/.direnv/python-3.10.6/bin",
+ "/Users/christiancueni/workspace/vbv_lernwelt/.direnv/python-3.10.6/bin",
];
let bashCommand = `PATH=${pythonPaths.join(":")}:$PATH && ${execCommand}`;
return cy
diff --git a/server/vbv_lernwelt/core/management/commands/cypress_reset.py b/server/vbv_lernwelt/core/management/commands/cypress_reset.py
index f45a9211..f8859b17 100644
--- a/server/vbv_lernwelt/core/management/commands/cypress_reset.py
+++ b/server/vbv_lernwelt/core/management/commands/cypress_reset.py
@@ -13,6 +13,7 @@ from vbv_lernwelt.core.constants import (
TEST_TRAINER1_USER_ID,
)
from vbv_lernwelt.core.models import User
+from vbv_lernwelt.course.consts import COURSE_TEST_ID
from vbv_lernwelt.course.creators.test_course import (
create_edoniq_test_result_data,
create_feedback_response_data,
@@ -20,6 +21,7 @@ from vbv_lernwelt.course.creators.test_course import (
create_test_assignment_submitted_data,
)
from vbv_lernwelt.course.models import (
+ Course,
CourseCompletion,
CourseCompletionStatus,
CourseSession,
@@ -73,6 +75,11 @@ from vbv_lernwelt.notify.models import Notification
default=False,
help="will create attendance days data",
)
+@click.option(
+ "--enable-circle-documents/--no-enable-circle-documents",
+ default=True,
+ help="will enable circle documents for test course",
+)
def command(
create_assignment_completion,
create_assignment_evaluation,
@@ -81,6 +88,7 @@ def command(
create_feedback_responses,
create_course_completion_performance_criteria,
create_attendance_days,
+ enable_circle_documents,
):
print("cypress reset data")
CourseCompletion.objects.all().delete()
@@ -243,3 +251,7 @@ def command(
datetime(year=2000, month=10, day=31, hour=11)
)
attendance_course.save()
+
+ course = Course.objects.get(id=COURSE_TEST_ID)
+ course.enable_circle_documents = enable_circle_documents
+ course.save()