From 67a19b851372211c1ee8fabb33b5bbee5b086342 Mon Sep 17 00:00:00 2001 From: Christian Cueni Date: Mon, 28 Oct 2024 15:07:33 +0100 Subject: [PATCH] Add new test circle, add tests --- client/src/components/AppFooter.vue | 2 +- .../cockpit/SubmissionsOverview.vue | 4 +- client/src/pages/cockpit/FeedbackPage.vue | 7 +- .../cockpit/FeedbackPageAutomobilgewerbe.vue | 59 ++++ .../e2e/competenceNavi/selfEvaluation.cy.js | 6 +- .../e2e/dashboard/dashboardSupervisor.cy.js | 18 +- cypress/e2e/feedback/feedbackStudent.cy.js | 320 +++++++++++++----- cypress/e2e/feedback/feedbackTrainer.cy.js | 125 +++++-- cypress/e2e/learningPath.cy.js | 48 +-- .../core/management/commands/cypress_reset.py | 55 +++ .../course/creators/test_course.py | 93 ++++- server/vbv_lernwelt/course/graphql/queries.py | 4 +- .../feedback/graphql/mutations.py | 4 +- server/vbv_lernwelt/feedback/services.py | 12 + .../vbv_lernwelt/learnpath/graphql/types.py | 8 +- ...learningcontentfeedbackautomobilgewerbe.py | 2 +- .../tests/learning_path_factories.py | 11 + .../vbv_lernwelt/learnpath/tests/test_api.py | 2 +- 18 files changed, 625 insertions(+), 155 deletions(-) create mode 100644 client/src/pages/cockpit/FeedbackPageAutomobilgewerbe.vue diff --git a/client/src/components/AppFooter.vue b/client/src/components/AppFooter.vue index 9b628dd4..2af2b506 100644 --- a/client/src/components/AppFooter.vue +++ b/client/src/components/AppFooter.vue @@ -36,8 +36,8 @@ async function changeLocale(language: AvailableLanguages) { diff --git a/client/src/components/cockpit/SubmissionsOverview.vue b/client/src/components/cockpit/SubmissionsOverview.vue index 77578d97..2ccbb10a 100644 --- a/client/src/components/cockpit/SubmissionsOverview.vue +++ b/client/src/components/cockpit/SubmissionsOverview.vue @@ -55,6 +55,7 @@ const submittables = computed(() => { lc.content_type === "learnpath.LearningContentAssignment" || lc.content_type === "learnpath.LearningContentFeedbackUK" || lc.content_type === "learnpath.LearningContentFeedbackVV" || + lc.content_type === "learnpath.LearningContentFeedbackAutomobilGewerbe" || lc.content_type === "learnpath.LearningContentEdoniqTest" ); @@ -76,7 +77,8 @@ const submittables = computed(() => { const isFeedback = (lc: LearningContent) => { return ( lc.content_type === "learnpath.LearningContentFeedbackUK" || - lc.content_type === "learnpath.LearningContentFeedbackVV" + lc.content_type === "learnpath.LearningContentFeedbackVV" || + lc.content_type === "learnpath.LearningContentFeedbackAutomobilGewerbe" ); }; diff --git a/client/src/pages/cockpit/FeedbackPage.vue b/client/src/pages/cockpit/FeedbackPage.vue index 9e88cf7b..d8908c9c 100644 --- a/client/src/pages/cockpit/FeedbackPage.vue +++ b/client/src/pages/cockpit/FeedbackPage.vue @@ -34,6 +34,10 @@ v-else-if="feedbackType === 'uk'" :feedback-data="feedbackData" /> + @@ -42,6 +46,7 @@ + + diff --git a/cypress/e2e/competenceNavi/selfEvaluation.cy.js b/cypress/e2e/competenceNavi/selfEvaluation.cy.js index 084de19c..888958dd 100644 --- a/cypress/e2e/competenceNavi/selfEvaluation.cy.js +++ b/cypress/e2e/competenceNavi/selfEvaluation.cy.js @@ -26,7 +26,7 @@ describe("selfEvaluation.cy.js", () => { cy.visit("/course/test-lehrgang/competence"); cy.get('[data-cy="self-evaluation-fail"]').should("have.text", "0"); cy.get('[data-cy="self-evaluation-success"]').should("have.text", "0"); - cy.get('[data-cy="self-evaluation-unknown"]').should("have.text", "4"); + cy.get('[data-cy="self-evaluation-unknown"]').should("have.text", "6"); // learning unit id = 692 also known as: // Bedarfsanalyse, Ist- und Soll-Situation <> @@ -45,7 +45,7 @@ describe("selfEvaluation.cy.js", () => { cy.makeSelfEvaluation([true, false]); cy.url().should( "include", - "/course/test-lehrgang/competence/self-evaluation-and-feedback" + "/course/test-lehrgang/competence/self-evaluation-and-feedback", ); // check data again on KompetenzNavi @@ -57,7 +57,7 @@ describe("selfEvaluation.cy.js", () => { cy.visit("/course/test-lehrgang/competence"); cy.get('[data-cy="self-evaluation-fail"]').should("have.text", "1"); cy.get('[data-cy="self-evaluation-success"]').should("have.text", "1"); - cy.get('[data-cy="self-evaluation-unknown"]').should("have.text", "2"); + cy.get('[data-cy="self-evaluation-unknown"]').should("have.text", "4"); }); it("should be able to make a happy self evaluation", () => { diff --git a/cypress/e2e/dashboard/dashboardSupervisor.cy.js b/cypress/e2e/dashboard/dashboardSupervisor.cy.js index 9e944dbd..8a4ca61c 100644 --- a/cypress/e2e/dashboard/dashboardSupervisor.cy.js +++ b/cypress/e2e/dashboard/dashboardSupervisor.cy.js @@ -16,7 +16,7 @@ describe("dashboardSupervisor.cy.js", () => { describe("with data", () => { beforeEach(() => { cy.manageCommand( - "cypress_reset --create-assignment-evaluation --create-feedback-responses --create-course-completion-performance-criteria --create-attendance-days" + "cypress_reset --create-assignment-evaluation --create-feedback-responses --create-course-completion-performance-criteria --create-attendance-days", ); login("test-supervisor1@example.com", "test"); cy.visit("/"); @@ -28,7 +28,7 @@ describe("dashboardSupervisor.cy.js", () => { // -> makes sure that the numbers are correct getDashboardStatistics("assignments.completed").should( "have.text", - "1" + "1", ); getDashboardStatistics("assignments.passed").should("have.text", "34%"); }); @@ -48,11 +48,11 @@ describe("dashboardSupervisor.cy.js", () => { it("contains correct numbers", () => { getDashboardStatistics("attendance.dayCompleted").should( "have.text", - "1" + "1", ); getDashboardStatistics("attendance.participantsPresent").should( "have.text", - "34%" + "34%", ); }); it("contains correct details link", () => { @@ -70,7 +70,7 @@ describe("dashboardSupervisor.cy.js", () => { describe("feedback summary box", () => { it("contains correct numbers", () => { getDashboardStatistics("feedback.average").should("have.text", "3.3"); - getDashboardStatistics("feedback.count").should("have.text", "6"); + getDashboardStatistics("feedback.count").should("have.text", "9"); }); it("contains correct details link", () => { clickOnDetailsLink("feedback"); @@ -106,7 +106,7 @@ describe("dashboardSupervisor.cy.js", () => { describe("with deducted points", () => { beforeEach(() => { cy.manageCommand( - "cypress_reset --create-assignment-evaluation --assignment-evaluation-scores 6,6,6,3,3 --assignment-points-deducted 14 --create-edoniq-test-results 19 24 8" + "cypress_reset --create-assignment-evaluation --assignment-evaluation-scores 6,6,6,3,3 --assignment-points-deducted 14 --create-edoniq-test-results 19 24 8", ); login("test-supervisor1@example.com", "test"); cy.visit("/"); @@ -120,14 +120,14 @@ describe("dashboardSupervisor.cy.js", () => { // check data on the details page cy.get( - '[data-cy="dashboard.stats.assignments"] [data-cy="basebox.detailsLink"]' + '[data-cy="dashboard.stats.assignments"] [data-cy="basebox.detailsLink"]', ).click(); cy.get( - '[data-cy="Edoniq Wissens- und Verständisfragen - Circle Fahrzeug (Demo)@-1"]' + '[data-cy="Edoniq Wissens- und Verständisfragen - Circle Fahrzeug (Demo)@-1"]', ).should("contain", "0 von 3 bestanden"); cy.get( - '[data-cy="Überprüfen einer Motorfahrzeugs-Versicherungspolice@-1"]' + '[data-cy="Überprüfen einer Motorfahrzeugs-Versicherungspolice@-1"]', ).should("contain", "0 von 3 bestanden"); }); }); diff --git a/cypress/e2e/feedback/feedbackStudent.cy.js b/cypress/e2e/feedback/feedbackStudent.cy.js index db15d44f..45cca602 100644 --- a/cypress/e2e/feedback/feedbackStudent.cy.js +++ b/cypress/e2e/feedback/feedbackStudent.cy.js @@ -30,93 +30,93 @@ describe("feedbackStudent.cy.js", () => { // fill feedback form // step 1 cy.url().should("include", "step=1"); - cy.get("[data-cy=\"question-1\"]").should( + cy.get('[data-cy="question-1"]').should( "contain", - "Zufriedenheit insgesamt" + "Zufriedenheit insgesamt", ); - cy.get("[data-cy=\"next-step\"]").should("be.disabled"); - cy.get("[data-cy=\"radio-4\"]").click(); + cy.get('[data-cy="next-step"]').should("be.disabled"); + cy.get('[data-cy="radio-4"]').click(); cy.wait(200); cy.learningContentMultiLayoutNextStep(); cy.wait(200); // step 2 cy.url().should("include", "step=2"); - cy.get("[data-cy=\"question-2\"]").should( + cy.get('[data-cy="question-2"]').should( "contain", - "Zielerreichung insgesamt" + "Zielerreichung insgesamt", ); - cy.get("[data-cy=\"next-step\"]").should("be.disabled"); + cy.get('[data-cy="next-step"]').should("be.disabled"); // the system should store after every step -> check stored data cy.loadFeedbackResponse("feedback_user_id", TEST_STUDENT1_USER_ID).then( (ac) => { expect(ac.submitted).to.be.false; expect(ac.data.satisfaction).to.equal(4); expect(ac.data.instructor_competence).to.equal(null); - } + }, ); - cy.get("[data-cy=\"radio-3\"]").click(); + cy.get('[data-cy="radio-3"]').click(); cy.wait(200); cy.learningContentMultiLayoutNextStep(); cy.wait(200); // step 3 cy.url().should("include", "step=3"); - cy.get("[data-cy=\"question-3\"]").should( + cy.get('[data-cy="question-3"]').should( "contain", - "Wie beurteilst du deine Sicherheit bezüglichen den Themen nach dem Kurs?" + "Wie beurteilst du deine Sicherheit bezüglichen den Themen nach dem Kurs?", ); - cy.get("[data-cy=\"next-step\"]").should("be.disabled"); - cy.get("[data-cy=\"radio-80\"]").click(); + cy.get('[data-cy="next-step"]').should("be.disabled"); + cy.get('[data-cy="radio-80"]').click(); cy.wait(200); cy.learningContentMultiLayoutNextStep(); cy.wait(200); // step 4 cy.url().should("include", "step=4"); - cy.get("[data-cy=\"question-4\"]").should( + cy.get('[data-cy="question-4"]').should( "contain", - "Waren die Vorbereitungsaufträge klar und verständlich?" + "Waren die Vorbereitungsaufträge klar und verständlich?", ); - cy.get("[data-cy=\"next-step\"]").should("be.disabled"); - cy.get("[data-cy=\"radio-false\"]").click(); + cy.get('[data-cy="next-step"]').should("be.disabled"); + cy.get('[data-cy="radio-false"]').click(); cy.wait(200); cy.learningContentMultiLayoutNextStep(); cy.wait(200); // step 5 cy.url().should("include", "step=5"); - cy.get("[data-cy=\"question-5\"]").should( + cy.get('[data-cy="question-5"]').should( "contain", - "Wie beurteilst du die Themensicherheit und Fachkompetenz des Kursleiters/der Kursleiterin?" + "Wie beurteilst du die Themensicherheit und Fachkompetenz des Kursleiters/der Kursleiterin?", ); - cy.get("[data-cy=\"next-step\"]").should("be.disabled"); - cy.get("[data-cy=\"radio-2\"]").click(); + cy.get('[data-cy="next-step"]').should("be.disabled"); + cy.get('[data-cy="radio-2"]').click(); cy.wait(200); cy.learningContentMultiLayoutNextStep(); cy.wait(200); // step 6 cy.url().should("include", "step=6"); - cy.get("[data-cy=\"question-6\"]").should( + cy.get('[data-cy="question-6"]').should( "contain", - "Wurden Fragen und Anregungen der Kursteilnehmenden ernst genommen und aufgegriffen?" + "Wurden Fragen und Anregungen der Kursteilnehmenden ernst genommen und aufgegriffen?", ); - cy.get("[data-cy=\"next-step\"]").should("be.disabled"); - cy.get("[data-cy=\"radio-1\"]").click(); + cy.get('[data-cy="next-step"]').should("be.disabled"); + cy.get('[data-cy="radio-1"]').click(); cy.wait(200); cy.learningContentMultiLayoutNextStep(); cy.wait(200); // step 7 cy.url().should("include", "step=7"); - cy.get("[data-cy=\"question-7\"]").should( + cy.get('[data-cy="question-7"]').should( "contain", - "Was möchtest du dem Kursleiter/der Kursleiterin sonst noch sagen?" + "Was möchtest du dem Kursleiter/der Kursleiterin sonst noch sagen?", ); - cy.get("[data-cy=\"next-step\"]").should("be.disabled"); - cy.get("[data-cy=\"it-textarea-instructor_open_feedback\"]").type( - "Der Kursleiter ist eigentlich ganz nett." + cy.get('[data-cy="next-step"]').should("be.disabled"); + cy.get('[data-cy="it-textarea-instructor_open_feedback"]').type( + "Der Kursleiter ist eigentlich ganz nett.", ); cy.wait(200); cy.learningContentMultiLayoutNextStep(); @@ -124,26 +124,26 @@ describe("feedbackStudent.cy.js", () => { // step 8 cy.url().should("include", "step=8"); - cy.get("[data-cy=\"question-8\"]").should( + cy.get('[data-cy="question-8"]').should( "contain", - "Würdest du den Kurs weiterempfehlen?" + "Würdest du den Kurs weiterempfehlen?", ); - cy.get("[data-cy=\"next-step\"]").should("be.disabled"); - cy.get("[data-cy=\"radio-true\"]").click(); + cy.get('[data-cy="next-step"]').should("be.disabled"); + cy.get('[data-cy="radio-true"]').click(); cy.wait(200); cy.learningContentMultiLayoutNextStep(); cy.wait(200); // step 9 cy.url().should("include", "step=9"); - cy.get("[data-cy=\"question-9\"]").should( + cy.get('[data-cy="question-9"]').should( "contain", - "Was hat dir besonders gut gefallen?" + "Was hat dir besonders gut gefallen?", ); - cy.get("[data-cy=\"next-step\"]").should("be.disabled"); - cy.get("[data-cy=\"it-textarea-course_positive_feedback\"]").type( - "Ich bin zufrieden mit den meisten Dingen." + cy.get('[data-cy="next-step"]').should("be.disabled"); + cy.get('[data-cy="it-textarea-course_positive_feedback"]').type( + "Ich bin zufrieden mit den meisten Dingen.", ); cy.wait(200); cy.learningContentMultiLayoutNextStep(); @@ -151,21 +151,21 @@ describe("feedbackStudent.cy.js", () => { // step 10 cy.url().should("include", "step=10"); - cy.get("[data-cy=\"question-10\"]").should( + cy.get('[data-cy="question-10"]').should( "contain", - "Wo siehst du Verbesserungspotential?" + "Wo siehst du Verbesserungspotential?", ); - cy.get("[data-cy=\"next-step\"]").should("be.disabled"); - cy.get("[data-cy=\"it-textarea-course_negative_feedback\"]").type( - "Ich bin unzufrieden mit einigen Sachen." + cy.get('[data-cy="next-step"]').should("be.disabled"); + cy.get('[data-cy="it-textarea-course_negative_feedback"]').type( + "Ich bin unzufrieden mit einigen Sachen.", ); cy.wait(200); cy.learningContentMultiLayoutNextStep(); cy.wait(200); cy.url().should("include", "step=11"); - cy.get("[data-cy=\"sendFeedbackButton\"]").click(); - cy.get("[data-cy=\"complete-and-continue\"]").click({ force: true }); + cy.get('[data-cy="sendFeedbackButton"]').click(); + cy.get('[data-cy="complete-and-continue"]').click({ force: true }); // marked complete in circle cy.url().should((url) => { @@ -173,7 +173,7 @@ describe("feedbackStudent.cy.js", () => { }); cy.reload(); cy.get( - "[data-cy=\"test-lehrgang-lp-circle-fahrzeug-lc-feedback-status\"]" + '[data-cy="test-lehrgang-lp-circle-fahrzeug-lc-feedback-status"]', ).should("have.attr", "aria-checked", "true"); // reopening page should get directly to last step @@ -197,9 +197,9 @@ describe("feedbackStudent.cy.js", () => { proficiency: 80, satisfaction: 4, would_recommend: true, - feedback_type: "uk" + feedback_type: "uk", }); - } + }, ); }); }); @@ -219,8 +219,8 @@ describe("feedbackStudent.cy.js", () => { cy.url().should((url) => { expect(url).to.match(/\/reisen\/feedback(\?step=0)?$/); }); - cy.get("[data-cy=\"introduction\"]").contains( - "Wir bitten dich um dein Feedback. Es hilft uns, damit wir deine Lernerlebnisse verbessern können." + cy.get('[data-cy="introduction"]').contains( + "Wir bitten dich um dein Feedback. Es hilft uns, damit wir deine Lernerlebnisse verbessern können.", ); cy.wait(200); @@ -230,82 +230,82 @@ describe("feedbackStudent.cy.js", () => { // fill feedback form // step 1 cy.url().should("include", "step=1"); - cy.get("[data-cy=\"question-1\"]").should( + cy.get('[data-cy="question-1"]').should( "contain", - "Zufriedenheit insgesamt" + "Zufriedenheit insgesamt", ); - cy.get("[data-cy=\"next-step\"]").should("be.disabled"); - cy.get("[data-cy=\"radio-4\"]").click(); + cy.get('[data-cy="next-step"]').should("be.disabled"); + cy.get('[data-cy="radio-4"]').click(); cy.wait(200); cy.learningContentMultiLayoutNextStep(); cy.wait(200); // step 2 cy.url().should("include", "step=2"); - cy.get("[data-cy=\"question-2\"]").should( + cy.get('[data-cy="question-2"]').should( "contain", - "Zielerreichung insgesamt" + "Zielerreichung insgesamt", ); - cy.get("[data-cy=\"next-step\"]").should("be.disabled"); + cy.get('[data-cy="next-step"]').should("be.disabled"); // the system should store after every step -> check stored data cy.loadFeedbackResponse("feedback_user_id", TEST_STUDENT1_USER_ID).then( (ac) => { expect(ac.submitted).to.be.false; expect(ac.data.satisfaction).to.equal(4); expect(ac.data.course_positive_feedback).to.equal(null); - } + }, ); - cy.get("[data-cy=\"radio-3\"]").click(); + cy.get('[data-cy="radio-3"]').click(); cy.wait(200); cy.learningContentMultiLayoutNextStep(); cy.wait(200); // step 3 cy.url().should("include", "step=3"); - cy.get("[data-cy=\"question-3\"]").should( + cy.get('[data-cy="question-3"]').should( "contain", - "Wie beurteilst du deine Sicherheit bezüglichen den Themen nach dem Circle?" + "Wie beurteilst du deine Sicherheit bezüglichen den Themen nach dem Circle?", ); - cy.get("[data-cy=\"next-step\"]").should("be.disabled"); - cy.get("[data-cy=\"radio-80\"]").click(); + cy.get('[data-cy="next-step"]').should("be.disabled"); + cy.get('[data-cy="radio-80"]').click(); cy.wait(200); cy.learningContentMultiLayoutNextStep(); cy.wait(200); // step 4 cy.url().should("include", "step=4"); - cy.get("[data-cy=\"question-4\"]").should( + cy.get('[data-cy="question-4"]').should( "contain", - "Waren die Praxisaufträge klar und verständlich?" + "Waren die Praxisaufträge klar und verständlich?", ); - cy.get("[data-cy=\"next-step\"]").should("be.disabled"); - cy.get("[data-cy=\"radio-false\"]").click(); + cy.get('[data-cy="next-step"]').should("be.disabled"); + cy.get('[data-cy="radio-false"]').click(); cy.wait(200); cy.learningContentMultiLayoutNextStep(); cy.wait(200); // step 5 cy.url().should("include", "step=5"); - cy.get("[data-cy=\"question-5\"]").should( + cy.get('[data-cy="question-5"]').should( "contain", - "Würdest du den Circle weiterempfehlen?" + "Würdest du den Circle weiterempfehlen?", ); - cy.get("[data-cy=\"next-step\"]").should("be.disabled"); - cy.get("[data-cy=\"radio-false\"]").click(); + cy.get('[data-cy="next-step"]').should("be.disabled"); + cy.get('[data-cy="radio-false"]').click(); cy.wait(200); cy.learningContentMultiLayoutNextStep(); cy.wait(200); // step 6 cy.url().should("include", "step=6"); - cy.get("[data-cy=\"question-6\"]").should( + cy.get('[data-cy="question-6"]').should( "contain", - "Was hat dir besonders gut gefallen?" + "Was hat dir besonders gut gefallen?", ); - cy.get("[data-cy=\"next-step\"]").should("be.disabled"); - cy.get("[data-cy=\"it-textarea-course_positive_feedback\"]").type( - "Der Circle ist eigentlich ganz nett." + cy.get('[data-cy="next-step"]').should("be.disabled"); + cy.get('[data-cy="it-textarea-course_positive_feedback"]').type( + "Der Circle ist eigentlich ganz nett.", ); cy.wait(200); cy.learningContentMultiLayoutNextStep(); @@ -313,21 +313,21 @@ describe("feedbackStudent.cy.js", () => { // step 7 cy.url().should("include", "step=7"); - cy.get("[data-cy=\"question-7\"]").should( + cy.get('[data-cy="question-7"]').should( "contain", - "Wo siehst du Verbesserungspotential?" + "Wo siehst du Verbesserungspotential?", ); - cy.get("[data-cy=\"next-step\"]").should("be.disabled"); - cy.get("[data-cy=\"it-textarea-course_negative_feedback\"]").type( - "Ich bin unzufrieden mit einigen Sachen." + cy.get('[data-cy="next-step"]').should("be.disabled"); + cy.get('[data-cy="it-textarea-course_negative_feedback"]').type( + "Ich bin unzufrieden mit einigen Sachen.", ); cy.wait(200); cy.learningContentMultiLayoutNextStep(); cy.wait(200); cy.url().should("include", "step=8"); - cy.get("[data-cy=\"sendFeedbackButton\"]").click(); - cy.get("[data-cy=\"complete-and-continue\"]").click({ force: true }); + cy.get('[data-cy="sendFeedbackButton"]').click(); + cy.get('[data-cy="complete-and-continue"]').click({ force: true }); // marked complete in circle cy.url().should((url) => { @@ -335,7 +335,7 @@ describe("feedbackStudent.cy.js", () => { }); cy.reload(); cy.get( - "[data-cy=\"test-lehrgang-lp-circle-reisen-lc-feedback-status\"]" + '[data-cy="test-lehrgang-lp-circle-reisen-lc-feedback-status"]', ).should("have.attr", "aria-checked", "true"); // reopening page should get directly to last step @@ -354,9 +354,155 @@ describe("feedbackStudent.cy.js", () => { proficiency: 80, satisfaction: 4, would_recommend: false, - feedback_type: "vv" + feedback_type: "vv", }); - } + }, + ); + }); + }); + + describe("Feedback Automobilgewerbe", () => { + beforeEach(() => { + cy.visit("/course/test-lehrgang/learn/automobilgewerbe/feedback"); + }); + + it("can open feedback page", () => { + cy.testLearningContentTitle("Feedback"); + cy.testLearningContentSubtitle("Feedback"); + }); + + it("can create feedback by giving answers to all steps", () => { + // initial wait for step 0 (or none with step==0) is required for pipelines + cy.url().should((url) => { + expect(url).to.match(/\/automobilgewerbe\/feedback(\?step=0)?$/); + }); + cy.get('[data-cy="introduction"]').contains( + "Wir bitten dich um dein Feedback. Es hilft uns, damit wir deine Lernerlebnisse verbessern können.", + ); + + cy.wait(200); + cy.learningContentMultiLayoutNextStep(); + cy.wait(200); + + // fill feedback form + // step 1 + cy.url().should("include", "step=1"); + cy.get('[data-cy="question-1"]').should( + "contain", + "Zufriedenheit insgesamt", + ); + cy.get('[data-cy="next-step"]').should("be.disabled"); + cy.get('[data-cy="radio-4"]').click(); + cy.wait(200); + cy.learningContentMultiLayoutNextStep(); + cy.wait(200); + + // step 2 + cy.url().should("include", "step=2"); + cy.get('[data-cy="question-2"]').should( + "contain", + "Zielerreichung insgesamt", + ); + cy.get('[data-cy="next-step"]').should("be.disabled"); + // the system should store after every step -> check stored data + cy.loadFeedbackResponse("feedback_user_id", TEST_STUDENT1_USER_ID).then( + (ac) => { + expect(ac.submitted).to.be.false; + expect(ac.data.satisfaction).to.equal(4); + expect(ac.data.course_positive_feedback).to.equal(null); + }, + ); + cy.get('[data-cy="radio-3"]').click(); + cy.wait(200); + cy.learningContentMultiLayoutNextStep(); + cy.wait(200); + + // step 3 + cy.url().should("include", "step=3"); + cy.get('[data-cy="question-3"]').should( + "contain", + "Wie beurteilst du deine Sicherheit bezüglichen den Themen nach dem Circle?", + ); + cy.get('[data-cy="next-step"]').should("be.disabled"); + cy.get('[data-cy="radio-80"]').click(); + cy.wait(200); + cy.learningContentMultiLayoutNextStep(); + cy.wait(200); + + // step 4 + cy.url().should("include", "step=4"); + cy.get('[data-cy="question-4"]').should( + "contain", + "Würdest du den Circle weiterempfehlen?", + ); + cy.get('[data-cy="next-step"]').should("be.disabled"); + cy.get('[data-cy="radio-false"]').click(); + cy.wait(200); + cy.learningContentMultiLayoutNextStep(); + cy.wait(200); + + // step 5 + cy.url().should("include", "step=5"); + cy.get('[data-cy="question-5"]').should( + "contain", + "Was hat dir besonders gut gefallen?", + ); + + cy.get('[data-cy="next-step"]').should("be.disabled"); + cy.get('[data-cy="it-textarea-course_positive_feedback"]').type( + "Der Circle ist eigentlich ganz nett.", + ); + cy.wait(200); + cy.learningContentMultiLayoutNextStep(); + cy.wait(200); + + // step 6 + cy.url().should("include", "step=6"); + cy.get('[data-cy="question-6"]').should( + "contain", + "Wo siehst du Verbesserungspotential?", + ); + cy.get('[data-cy="next-step"]').should("be.disabled"); + cy.get('[data-cy="it-textarea-course_negative_feedback"]').type( + "Ich bin unzufrieden mit einigen Sachen.", + ); + cy.wait(200); + cy.learningContentMultiLayoutNextStep(); + cy.wait(200); + + cy.url().should("include", "step=7"); + cy.get('[data-cy="sendFeedbackButton"]').click(); + cy.get('[data-cy="complete-and-continue"]').click({ force: true }); + + // marked complete in circle + cy.url().should((url) => { + expect(url).to.match( + /\/automobilgewerbe#lu-transfer-reflexion-feedback?$/, + ); + }); + cy.reload(); + cy.get( + '[data-cy="test-lehrgang-lp-circle-automobilgewerbe-lc-feedback-status"]', + ).should("have.attr", "aria-checked", "true"); + + // reopening page should get directly to last step + cy.visit("/course/test-lehrgang/learn/automobilgewerbe/feedback"); + cy.url().should("include", "step=7"); + + // check stored data + cy.loadFeedbackResponse("feedback_user_id", TEST_STUDENT1_USER_ID).then( + (ac) => { + expect(ac.submitted).to.be.true; + expect(ac.data).to.deep.equal({ + course_negative_feedback: "Ich bin unzufrieden mit einigen Sachen.", + course_positive_feedback: "Der Circle ist eigentlich ganz nett.", + goal_attainment: 3, + proficiency: 80, + satisfaction: 4, + would_recommend: false, + feedback_type: "automobilgewerbe", + }); + }, ); }); }); diff --git a/cypress/e2e/feedback/feedbackTrainer.cy.js b/cypress/e2e/feedback/feedbackTrainer.cy.js index 055bea3b..dfba6705 100644 --- a/cypress/e2e/feedback/feedbackTrainer.cy.js +++ b/cypress/e2e/feedback/feedbackTrainer.cy.js @@ -1,4 +1,4 @@ -import {EXPERT_COCKPIT_URL, login} from "../helpers"; +import { EXPERT_COCKPIT_URL, login } from "../helpers"; describe("feedbackTrainer.cy.js", () => { beforeEach(() => { @@ -10,7 +10,7 @@ describe("feedbackTrainer.cy.js", () => { login("test-trainer1@example.com", "test"); cy.visit(EXPERT_COCKPIT_URL); cy.get( - '[data-cy="show-feedback-btn-test-lehrgang-lp-circle-fahrzeug-lc-feedback"]' + '[data-cy="show-feedback-btn-test-lehrgang-lp-circle-fahrzeug-lc-feedback"]', ).click(); cy.get('[data-cy="feedback-data-amount"]').should("contain", "0"); @@ -22,7 +22,7 @@ describe("feedbackTrainer.cy.js", () => { login("test-trainer1@example.com", "test"); cy.visit(EXPERT_COCKPIT_URL); cy.get( - '[data-cy="show-feedback-btn-test-lehrgang-lp-circle-fahrzeug-lc-feedback"]' + '[data-cy="show-feedback-btn-test-lehrgang-lp-circle-fahrzeug-lc-feedback"]', ).click(); cy.get('[data-cy="feedback-data-amount"]').should("contain", "3"); @@ -30,43 +30,43 @@ describe("feedbackTrainer.cy.js", () => { // check titles of questions cy.get('[data-cy="question-1"]').should( "contain", - "Zufriedenheit insgesamt" + "Zufriedenheit insgesamt", ); cy.get('[data-cy="question-2"]').should( "contain", - "Zielerreichung insgesamt" + "Zielerreichung insgesamt", ); cy.get('[data-cy="question-3"]').should( "contain", - "Wie beurteilst du deine Sicherheit bezüglichen den Themen nach dem Kurs?" + "Wie beurteilst du deine Sicherheit bezüglichen den Themen nach dem Kurs?", ); cy.get('[data-cy="question-4"]').should( "contain", - "Waren die Vorbereitungsaufträge klar und verständlich?" + "Waren die Vorbereitungsaufträge klar und verständlich?", ); cy.get('[data-cy="question-5"]').should( "contain", - "Wie beurteilst du die Themensicherheit und Fachkompetenz des Kursleiters/der Kursleiterin?" + "Wie beurteilst du die Themensicherheit und Fachkompetenz des Kursleiters/der Kursleiterin?", ); cy.get('[data-cy="question-6"]').should( "contain", - "Wurden Fragen und Anregungen der Kursteilnehmenden ernst genommen und aufgegriffen?" + "Wurden Fragen und Anregungen der Kursteilnehmenden ernst genommen und aufgegriffen?", ); cy.get('[data-cy="question-7"]').should( "contain", - "Was möchtest du dem Kursleiter/der Kursleiterin sonst noch sagen?" + "Was möchtest du dem Kursleiter/der Kursleiterin sonst noch sagen?", ); cy.get('[data-cy="question-8"]').should( "contain", - "Würdest du den Kurs weiterempfehlen?" + "Würdest du den Kurs weiterempfehlen?", ); cy.get('[data-cy="question-9"]').should( "contain", - "Wo siehst du Verbesserungspotential?" + "Wo siehst du Verbesserungspotential?", ); cy.get('[data-cy="question-10"]').should( "contain", - "Was hat dir besonders gut gefallen?" + "Was hat dir besonders gut gefallen?", ); cy.get('[data-cy="question-1"]') @@ -142,7 +142,7 @@ describe("feedbackTrainer.cy.js", () => { cy.get('[data-cy="dropdown-select"]').click(); cy.get('[data-cy="dropdown-select-option-Reisen"]').click(); cy.get( - '[data-cy="show-feedback-btn-test-lehrgang-lp-circle-reisen-lc-feedback"]' + '[data-cy="show-feedback-btn-test-lehrgang-lp-circle-reisen-lc-feedback"]', ).click(); cy.get('[data-cy="feedback-data-amount"]').should("contain", "3"); @@ -150,31 +150,31 @@ describe("feedbackTrainer.cy.js", () => { // check titles of questions cy.get('[data-cy="question-1"]').should( "contain", - "Zufriedenheit insgesamt" + "Zufriedenheit insgesamt", ); cy.get('[data-cy="question-2"]').should( "contain", - "Zielerreichung insgesamt" + "Zielerreichung insgesamt", ); cy.get('[data-cy="question-3"]').should( "contain", - "Wie beurteilst du deine Sicherheit bezüglichen den Themen nach dem Circle?" + "Wie beurteilst du deine Sicherheit bezüglichen den Themen nach dem Circle?", ); cy.get('[data-cy="question-4"]').should( "contain", - "Waren die Praxisaufträge klar und verständlich?" + "Waren die Praxisaufträge klar und verständlich?", ); cy.get('[data-cy="question-5"]').should( "contain", - "Würdest du den Circle weiterempfehlen?" + "Würdest du den Circle weiterempfehlen?", ); cy.get('[data-cy="question-6"]').should( "contain", - "Wo siehst du Verbesserungspotential?" + "Wo siehst du Verbesserungspotential?", ); cy.get('[data-cy="question-7"]').should( "contain", - "Was hat dir besonders gut gefallen?" + "Was hat dir besonders gut gefallen?", ); cy.get('[data-cy="question-1"]') @@ -228,4 +228,87 @@ describe("feedbackTrainer.cy.js", () => { .should("contain", "Die Präsentation war super"); }); }); + + describe("FeedbackAutomobilGewerbe", function () { + it("can open feedback results page with results", () => { + cy.manageCommand("cypress_reset --create-feedback-responses"); + login("test-trainer1@example.com", "test"); + cy.visit(EXPERT_COCKPIT_URL); + cy.get('[data-cy="dropdown-select"]').click(); + cy.get('[data-cy="dropdown-select-option-Automobilgewerbe"]').click(); + cy.get( + '[data-cy="show-feedback-btn-test-lehrgang-lp-circle-automobilgewerbe-lc-feedback"]', + ).click(); + + cy.get('[data-cy="feedback-data-amount"]').should("contain", "3"); + + // check titles of questions + cy.get('[data-cy="question-1"]').should( + "contain", + "Zufriedenheit insgesamt", + ); + cy.get('[data-cy="question-2"]').should( + "contain", + "Zielerreichung insgesamt", + ); + cy.get('[data-cy="question-3"]').should( + "contain", + "Wie beurteilst du deine Sicherheit bezüglichen den Themen nach dem Circle?", + ); + cy.get('[data-cy="question-4"]').should( + "contain", + "Würdest du den Circle weiterempfehlen?", + ); + cy.get('[data-cy="question-5"]').should( + "contain", + "Wo siehst du Verbesserungspotential?", + ); + cy.get('[data-cy="question-6"]').should( + "contain", + "Was hat dir besonders gut gefallen?", + ); + + cy.get('[data-cy="question-1"]') + .find('[data-cy="rating-scale-average"]') + .should("contain", "3.3"); + + cy.get('[data-cy="question-2"]') + .find('[data-cy="rating-scale-average"]') + .should("contain", "3.0"); + + cy.get('[data-cy="question-3"]') + .find('[data-cy="percentage-value-40%"]') + .should("contain", "33.3"); + cy.get('[data-cy="question-3"]') + .find('[data-cy="percentage-value-80%"]') + .should("contain", "33.3"); + cy.get('[data-cy="question-3"]') + .find('[data-cy="percentage-value-100%"]') + .should("contain", "33.3"); + + cy.get('[data-cy="question-4"]') + .find('[data-cy="popover-yes"]') + .click() + .find('[data-cy="num-yes"]') + .should("contain", "2"); + cy.get('[data-cy="question-4"]') + .find('[data-cy="popover-no"]') + .click() + .find('[data-cy="num-no"]') + .should("contain", "1"); + + cy.get('[data-cy="question-5"]') + .should("contain", "Nichts Schlechtes") + .should("contain", "Es wäre praktisch, Zugang zu einer FAQ zu haben.") + .should("contain", "Mehr Videos wären schön."); + + cy.get('[data-cy="question-6"]') + .should("contain", "Nur Gutes.") + .should( + "contain", + "Das Beispiel mit der Katze fand ich sehr gut veranschaulicht!", + ) + .should("contain", "Die Präsentation war super"); + }); + }); }); diff --git a/cypress/e2e/learningPath.cy.js b/cypress/e2e/learningPath.cy.js index b3a33c09..3c79f4c4 100644 --- a/cypress/e2e/learningPath.cy.js +++ b/cypress/e2e/learningPath.cy.js @@ -8,57 +8,61 @@ describe("learningPath.cy.js", () => { }); it("can open learningPath page", () => { - cy.get("[data-cy=\"learning-path-title\"]").should( + cy.get('[data-cy="learning-path-title"]').should( "contain", - "Test Lehrgang" + "Test Lehrgang", ); }); it("can click on circle to open it", () => { - cy.get("[data-cy=\"circle-Fahrzeug\"]").click({ force: true }); + cy.get('[data-cy="circle-Fahrzeug"]').click({ force: true }); cy.url().should("include", "/course/test-lehrgang/learn/fahrzeug"); - cy.get("[data-cy=\"circle-title\"]").should("contain", "Fahrzeug"); + cy.get('[data-cy="circle-title"]').should("contain", "Fahrzeug"); }); it("switch between list and path view", () => { - cy.get("[data-cy=\"lp-path-view\"]").should("be.visible"); - cy.get("[data-cy=\"view-switch\"]").click(); - cy.get("[data-cy=\"lp-list-view\"]").should("be.visible"); - cy.get("[data-cy=\"view-switch\"]").click(); - cy.get("[data-cy=\"lp-path-view\"]").should("be.visible"); + cy.get('[data-cy="lp-path-view"]').should("be.visible"); + cy.get('[data-cy="view-switch"]').click(); + cy.get('[data-cy="lp-list-view"]').should("be.visible"); + cy.get('[data-cy="view-switch"]').click(); + cy.get('[data-cy="lp-path-view"]').should("be.visible"); }); it("weiter gehts button will open next circle", () => { // first click will open first circle - cy.get("[data-cy=\"lp-continue-button\"]") + cy.get('[data-cy="lp-continue-button"]') .filter(":visible") .should("contain", "Los geht's") .click(); - cy.get("[data-cy=\"circle-title\"]").should("contain", "Fahrzeug"); - cy.get("[data-cy=\"back-to-learning-path-button\"]").click(); + cy.get('[data-cy="circle-title"]').should("contain", "Fahrzeug"); + cy.get('[data-cy="back-to-learning-path-button"]').click(); // mark a learning content in second circle - cy.get("[data-cy=\"circle-Reisen\"]").click({ force: true }); - cy.get("[data-cy=\"ls-continue-button\"]").click(); - cy.get("[data-cy=\"complete-and-continue\"]").click({ force: true }); - cy.get("[data-cy=\"back-to-learning-path-button\"]").click(); + cy.get('[data-cy="circle-Reisen"]').click({ force: true }); + cy.get('[data-cy="ls-continue-button"]').click(); + cy.get('[data-cy="complete-and-continue"]').click({ force: true }); + cy.get('[data-cy="back-to-learning-path-button"]').click(); // click on continue should go to unit-test-circle - cy.get("[data-cy=\"lp-continue-button\"]") + cy.get('[data-cy="lp-continue-button"]') .filter(":visible") .should("contain", "Weiter geht's") .click(); - cy.get("[data-cy=\"circle-title\"]").should("contain", "Reisen"); + cy.get('[data-cy="circle-title"]').should("contain", "Reisen"); }); it("checks contents", () => { - cy.get("[data-cy=\"lp-topic\"]").should("have.length", 2); - cy.get("[data-cy=\"lp-topic\"]").first().should("contain", "Circle ÜK"); - cy.get("[data-cy=\"lp-topic\"]").eq(1).should("contain", "Circle VV"); + cy.get('[data-cy="lp-topic"]').should("have.length", 3); + cy.get('[data-cy="lp-topic"]').first().should("contain", "Circle ÜK"); + cy.get('[data-cy="lp-topic"]').eq(1).should("contain", "Circle VV"); + cy.get('[data-cy="lp-topic"]') + .eq(2) + .should("contain", "Circle Automobilgewerbe"); - cy.get(".cy-lp-circle").should("have.length", 2); + cy.get(".cy-lp-circle").should("have.length", 3); cy.get(".cy-lp-circle").first().should("contain", "Fahrzeug"); cy.get(".cy-lp-circle").eq(1).should("contain", "Reisen"); + cy.get(".cy-lp-circle").eq(2).should("contain", "Automobilgewerbe"); }); }); diff --git a/server/vbv_lernwelt/core/management/commands/cypress_reset.py b/server/vbv_lernwelt/core/management/commands/cypress_reset.py index 507ff23c..88830660 100644 --- a/server/vbv_lernwelt/core/management/commands/cypress_reset.py +++ b/server/vbv_lernwelt/core/management/commands/cypress_reset.py @@ -53,6 +53,7 @@ from vbv_lernwelt.learning_mentor.models import ( ) from vbv_lernwelt.learnpath.models import ( LearningContentAttendanceCourse, + LearningContentFeedbackAutomobilGewerbe, LearningContentFeedbackUK, LearningContentFeedbackVV, ) @@ -404,6 +405,60 @@ def command( }, ) + # feedback automobilgewerbe + learning_content_feedback_page = ( + LearningContentFeedbackAutomobilGewerbe.objects.get( + slug="test-lehrgang-lp-circle-automobilgewerbe-lc-feedback" + ) + ) + create_feedback_response_data( + feedback_user=User.objects.get(id=TEST_STUDENT1_USER_ID), + course_session=course_session, + learning_content_feedback_page=learning_content_feedback_page, + submitted=True, + feedback_data={ + "satisfaction": 4, + "goal_attainment": 3, + "proficiency": 80, + "would_recommend": True, + "course_negative_feedback": "Nichts Schlechtes", + "course_positive_feedback": "Nur Gutes.", + "feedback_type": "automobilgewerbe", + }, + ) + + create_feedback_response_data( + feedback_user=User.objects.get(id=TEST_STUDENT2_USER_ID), + course_session=course_session, + learning_content_feedback_page=learning_content_feedback_page, + submitted=True, + feedback_data={ + "satisfaction": 4, + "goal_attainment": 4, + "proficiency": 100, + "would_recommend": True, + "course_negative_feedback": "Es wäre praktisch, Zugang zu einer FAQ zu haben.", + "course_positive_feedback": "Das Beispiel mit der Katze fand ich sehr gut veranschaulicht!", + "feedback_type": "automobilgewerbe", + }, + ) + + create_feedback_response_data( + feedback_user=User.objects.get(id=TEST_STUDENT3_USER_ID), + course_session=course_session, + learning_content_feedback_page=learning_content_feedback_page, + submitted=True, + feedback_data={ + "satisfaction": 2, + "goal_attainment": 2, + "proficiency": 40, + "would_recommend": False, + "course_negative_feedback": "Mehr Videos wären schön.", + "course_positive_feedback": "Die Präsentation war super", + "feedback_type": "automobilgewerbe", + }, + ) + if create_course_completion_performance_criteria: member = User.objects.get(id=TEST_STUDENT1_USER_ID) course_session = CourseSession.objects.get(id=TEST_COURSE_SESSION_BERN_ID) diff --git a/server/vbv_lernwelt/course/creators/test_course.py b/server/vbv_lernwelt/course/creators/test_course.py index da4d6392..1ce9594a 100644 --- a/server/vbv_lernwelt/course/creators/test_course.py +++ b/server/vbv_lernwelt/course/creators/test_course.py @@ -80,6 +80,7 @@ from vbv_lernwelt.learnpath.tests.learning_path_factories import ( LearningContentAssignmentFactory, LearningContentAttendanceCourseFactory, LearningContentEdoniqTestFactory, + LearningContentFeedbackAutomobilGewerbeFactory, LearningContentFeedbackUKFactory, LearningContentFeedbackVVFactory, LearningContentKnowledgeAssessmentFactory, @@ -108,7 +109,11 @@ from vbv_lernwelt.media_library.tests.media_library_factories import ( def create_test_course( - include_uk=True, include_vv=True, with_sessions=False, with_documents=False + include_uk=True, + include_vv=True, + include_automobilgewerbe=True, + with_sessions=False, + with_documents=False, ): # create_locales_for_wagtail() create_default_collections() @@ -331,6 +336,11 @@ def create_test_course( if include_vv: csu.expert.add(Circle.objects.get(slug="test-lehrgang-lp-circle-reisen")) + if include_automobilgewerbe: + csu.expert.add( + Circle.objects.get(slug="test-lehrgang-lp-circle-automobilgewerbe") + ) + trainer2 = User.objects.get(email="test-trainer2@example.com") csu = CourseSessionUser.objects.create( course_session=cs_zurich, @@ -594,7 +604,12 @@ def create_test_course_with_categories(apps=None, schema_editor=None): return course -def create_test_learning_path(include_uk=True, include_vv=True, with_documents=False): +def create_test_learning_path( + include_uk=True, + include_vv=True, + include_automobil_gewerbe=True, + with_documents=False, +): course_page = CoursePage.objects.get(course_id=COURSE_TEST_ID) lp = LearningPathFactory(title="Test Lernpfad", parent=course_page) @@ -608,6 +623,10 @@ def create_test_learning_path(include_uk=True, include_vv=True, with_documents=F TopicFactory(title="Circle VV", is_visible=False, parent=lp) create_test_circle_reisen(lp) + if include_automobil_gewerbe: + TopicFactory(title="Circle Automobilgewerbe", is_visible=False, parent=lp) + create_test_circle_automobilgewerbe(lp) + def create_test_uk_circle_fahrzeug(lp, title="Fahrzeug", with_documents=False): circle = CircleFactory( @@ -843,6 +862,76 @@ def create_test_circle_reisen(lp): ) +def create_test_circle_automobilgewerbe(lp): + circle = CircleFactory( + title="Automobilgewerbe", + parent=lp, + ) + LearningSequenceFactory(title="Starten", parent=circle, icon="it-icon-ls-start") + LearningUnitFactory(title="Einführung", parent=circle) + LearningContentVideoFactory( + title="Verschaff dir einen Überblick", + parent=circle, + content_url="https://player.vimeo.com/video/772512710?h=30f912f15a", + description="Willkommen im Lehrgang Automobilgewerbe", + ) + + LearningSequenceFactory(title="Training", parent=circle) + LearningUnitFactory(title="Unterlagen", parent=circle) + LearningContentPlaceholderFactory( + title="Unterlagen für den Unterricht", + parent=circle, + ) + + LearningSequenceFactory(title="Analyse", parent=circle) + # analyse + lu = LearningUnitFactory( + title="Bedarfsanalyse, Ist- und Soll-Situation", + parent=circle, + course_category=CourseCategory.objects.get( + course_id=COURSE_TEST_ID, title="Reisen" + ), + ) + + LearningContentLearningModuleFactory( + title="Emma und Ayla campen durch Amerika - Analyse", + parent=circle, + content_url="https://s3.eu-central-1.amazonaws.com/myvbv-wbt.iterativ.ch/emma-und-ayla-campen-durch-amerika-analyse-xapi-FZoZOP9y/index.html", + ) + + PerformanceCriteriaFactory( + parent=ActionCompetence.objects.get(competence_id="Y1"), + competence_id="Y1.1", + title="Ich bin fähig zu Reisen eine Gesprächsführung zu machen", + learning_unit=lu, + ) + PerformanceCriteriaFactory( + parent=ActionCompetence.objects.get(competence_id="Y2"), + competence_id="Y2.1", + title="Ich bin fähig zu Reisen eine Analyse zu machen", + learning_unit=lu, + ) + + # transfer + parent = circle + LearningSequenceFactory(title="Transfer", parent=parent, icon="it-icon-ls-end") + LearningUnitFactory(title="Transfer, Reflexion, Feedback", parent=parent) + LearningContentKnowledgeAssessmentFactory( + title="Wissens- und Verständnisfragen", + parent=parent, + content_url="https://s3.eu-central-1.amazonaws.com/myvbv-wbt.iterativ.ch/emma-und-ayla-campen-durch-amerika-analyse-xapi-FZoZOP9y/index.html", + ) + LearningContentPlaceholderFactory( + title="Reflexion", + parent=parent, + ) + + LearningContentFeedbackAutomobilGewerbeFactory( + title="Feedback", + parent=parent, + ) + + def create_test_competence_navi(): course_page = CoursePage.objects.get(course_id=COURSE_TEST_ID) diff --git a/server/vbv_lernwelt/course/graphql/queries.py b/server/vbv_lernwelt/course/graphql/queries.py index 46515ad5..c5edf43b 100644 --- a/server/vbv_lernwelt/course/graphql/queries.py +++ b/server/vbv_lernwelt/course/graphql/queries.py @@ -54,7 +54,9 @@ class CourseQuery(graphene.ObjectType): ) learning_content_feedback_uk = graphene.Field(LearningContentFeedbackUKObjectType) learning_content_feedback_vv = graphene.Field(LearningContentFeedbackVVObjectType) - learning_content_feedback_automobil_gewerbe = graphene.Field(LearningContentFeedbackAutomobilGewerbeObjectType) + learning_content_feedback_automobil_gewerbe = graphene.Field( + LearningContentFeedbackAutomobilGewerbeObjectType + ) learning_content_learning_module = graphene.Field( LearningContentLearningModuleObjectType ) diff --git a/server/vbv_lernwelt/feedback/graphql/mutations.py b/server/vbv_lernwelt/feedback/graphql/mutations.py index 24ac5749..55b023c0 100644 --- a/server/vbv_lernwelt/feedback/graphql/mutations.py +++ b/server/vbv_lernwelt/feedback/graphql/mutations.py @@ -58,7 +58,9 @@ class SendFeedbackMutation(graphene.Mutation): learningContentFeedbackModel = LearningContentFeedbackUK serializerClass = CourseFeedbackSerializerUK data["feedback_type"] = "uk" - elif learning_content_type == "learnpath.LearningContentFeedbackAutomobilGewerbe": + elif ( + learning_content_type == "learnpath.LearningContentFeedbackAutomobilGewerbe" + ): learningContentFeedbackModel = LearningContentFeedbackAutomobilGewerbe serializerClass = CourseFeedbackSerializerAutomobilGewerbe data["feedback_type"] = "automobilgewerbe" diff --git a/server/vbv_lernwelt/feedback/services.py b/server/vbv_lernwelt/feedback/services.py index 9e561746..889ccfc7 100644 --- a/server/vbv_lernwelt/feedback/services.py +++ b/server/vbv_lernwelt/feedback/services.py @@ -104,6 +104,18 @@ def initial_data_for_feedback_page( "course_positive_feedback": "", "feedback_type": "vv", } + if hasattr( + learning_content_feedback_page, "learningcontentfeedbackautomobilgewerbe" + ): + return { + "satisfaction": None, + "goal_attainment": None, + "proficiency": None, + "would_recommend": None, + "course_negative_feedback": "", + "course_positive_feedback": "", + "feedback_type": "vv", + } return {} diff --git a/server/vbv_lernwelt/learnpath/graphql/types.py b/server/vbv_lernwelt/learnpath/graphql/types.py index 8ab49098..18ab4640 100644 --- a/server/vbv_lernwelt/learnpath/graphql/types.py +++ b/server/vbv_lernwelt/learnpath/graphql/types.py @@ -260,7 +260,7 @@ class LearningUnitObjectType(DjangoObjectType): if hasattr(info.context, "circle_descendants"): circle_descendants = info.context.circle_descendants index = circle_descendants.index(self) - siblings = circle_descendants[index + 1:] + siblings = circle_descendants[index + 1 :] if not siblings: siblings = self.get_siblings().live().specific() @@ -293,7 +293,7 @@ class LearningSequenceObjectType(DjangoObjectType): if hasattr(info.context, "circle_descendants"): circle_descendants = info.context.circle_descendants index = circle_descendants.index(root) - siblings = circle_descendants[index + 1:] + siblings = circle_descendants[index + 1 :] if not siblings: siblings = root.get_siblings().live().specific() @@ -325,7 +325,7 @@ class CircleObjectType(DjangoObjectType): if hasattr(info.context, "learning_path_descendants"): children = info.context.learning_path_descendants circle_start_index = children.index(self) - next_children = children[circle_start_index + 1:] + next_children = children[circle_start_index + 1 :] next_circle_index = find_first_index( next_children, pred=lambda child: child.specific_class == Circle, @@ -368,7 +368,7 @@ class TopicObjectType(DjangoObjectType): if hasattr(info.context, "learning_path_descendants"): learning_path_descendants = info.context.learning_path_descendants index = learning_path_descendants.index(root) - siblings = learning_path_descendants[index + 1:] + siblings = learning_path_descendants[index + 1 :] if not siblings: siblings = root.get_next_siblings().live().specific() diff --git a/server/vbv_lernwelt/learnpath/migrations/0021_learningcontentfeedbackautomobilgewerbe.py b/server/vbv_lernwelt/learnpath/migrations/0021_learningcontentfeedbackautomobilgewerbe.py index 9457b7b4..5229d031 100644 --- a/server/vbv_lernwelt/learnpath/migrations/0021_learningcontentfeedbackautomobilgewerbe.py +++ b/server/vbv_lernwelt/learnpath/migrations/0021_learningcontentfeedbackautomobilgewerbe.py @@ -1,8 +1,8 @@ # Generated by Django 4.2.13 on 2024-10-28 09:59 -from django.db import migrations, models import django.db.models.deletion import wagtail.fields +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/server/vbv_lernwelt/learnpath/tests/learning_path_factories.py b/server/vbv_lernwelt/learnpath/tests/learning_path_factories.py index 85b8f45b..eb3b2698 100644 --- a/server/vbv_lernwelt/learnpath/tests/learning_path_factories.py +++ b/server/vbv_lernwelt/learnpath/tests/learning_path_factories.py @@ -7,6 +7,7 @@ from vbv_lernwelt.learnpath.models import ( LearningContentAttendanceCourse, LearningContentDocumentList, LearningContentEdoniqTest, + LearningContentFeedbackAutomobilGewerbe, LearningContentFeedbackUK, LearningContentFeedbackVV, LearningContentKnowledgeAssessment, @@ -141,6 +142,16 @@ class LearningContentFeedbackUKFactory(wagtail_factories.PageFactory): model = LearningContentFeedbackUK +class LearningContentFeedbackAutomobilGewerbeFactory(wagtail_factories.PageFactory): + title = "FeedbackAutomobilGewerbe" + minutes = 0 + content_url = "" + description = RichText("") + + class Meta: + model = LearningContentFeedbackAutomobilGewerbe + + class LearningContentLearningModuleFactory(wagtail_factories.PageFactory): title = "Beispiel Lernmodul" minutes = 0 diff --git a/server/vbv_lernwelt/learnpath/tests/test_api.py b/server/vbv_lernwelt/learnpath/tests/test_api.py index 8f69740d..e22ab13d 100644 --- a/server/vbv_lernwelt/learnpath/tests/test_api.py +++ b/server/vbv_lernwelt/learnpath/tests/test_api.py @@ -26,7 +26,7 @@ class TestRetrieveLearingPathContents(APITestCase): self.assertEqual(self.learning_path.title, data["title"]) # topics and circles - self.assertEqual(4, len(data["children"])) + self.assertEqual(6, len(data["children"])) # circle "analyse" contents self.assertEqual(20, len(data["children"][3]["children"]))