From 2e408643bc7f289d5104846ebb39ea3dcc03580b Mon Sep 17 00:00:00 2001 From: Christian Cueni Date: Wed, 29 Nov 2023 16:47:42 +0100 Subject: [PATCH] wip: Update course creation --- .../core/management/commands/cypress_reset.py | 6 ++--- .../course/creators/test_course.py | 6 ++--- .../vbv_lernwelt/course/creators/uk_course.py | 22 +++++++++---------- server/vbv_lernwelt/feedback/services.py | 11 ++++++++-- .../learnpath/create_vv_new_learning_path.py | 22 +++++++++---------- .../vbv_lernwelt/learnpath/graphql/types.py | 5 ++++- .../tests/learning_path_factories.py | 19 ++++++++++++---- 7 files changed, 56 insertions(+), 35 deletions(-) diff --git a/server/vbv_lernwelt/core/management/commands/cypress_reset.py b/server/vbv_lernwelt/core/management/commands/cypress_reset.py index 2b1ab3ea..eaa99484 100644 --- a/server/vbv_lernwelt/core/management/commands/cypress_reset.py +++ b/server/vbv_lernwelt/core/management/commands/cypress_reset.py @@ -32,7 +32,7 @@ from vbv_lernwelt.course_session.services.attendance import AttendanceUserStatus from vbv_lernwelt.feedback.models import FeedbackResponse from vbv_lernwelt.learnpath.models import ( LearningContentAttendanceCourse, - LearningContentFeedback, + LearningContentFeedbackUK, ) from vbv_lernwelt.notify.models import Notification @@ -155,8 +155,8 @@ def command( if create_feedback_responses: print("create_feedback_responses") course_session = CourseSession.objects.get(id=TEST_COURSE_SESSION_BERN_ID) - learning_content_feedback_page = LearningContentFeedback.objects.get( - slug="test-lehrgang-lp-circle-fahrzeug-lc-feedback" + learning_content_feedback_page = LearningContentFeedbackUK.objects.get( + slug="test-lehrgang-lp-circle-fahrzeug-lc-feedbackuk" ) create_feedback_response_data( feedback_user=User.objects.get(id=TEST_STUDENT1_USER_ID), diff --git a/server/vbv_lernwelt/course/creators/test_course.py b/server/vbv_lernwelt/course/creators/test_course.py index 6c659c9d..bdf25e5c 100644 --- a/server/vbv_lernwelt/course/creators/test_course.py +++ b/server/vbv_lernwelt/course/creators/test_course.py @@ -70,7 +70,7 @@ from vbv_lernwelt.learnpath.tests.learning_path_factories import ( LearningContentAssignmentFactory, LearningContentAttendanceCourseFactory, LearningContentEdoniqTestFactory, - LearningContentFeedbackFactory, + LearningContentFeedbackUKFactory, LearningContentKnowledgeAssessmentFactory, LearningContentLearningModuleFactory, LearningContentMediaLibraryFactory, @@ -530,7 +530,7 @@ damit du erfolgreich mit deinem Lernpfad (durch-)starten kannst. slug__startswith="test-lehrgang-assignment-überprüfen-einer-motorfahrzeugs" ), ) - LearningContentFeedbackFactory( + LearningContentFeedbackUKFactory( parent=circle, ) @@ -614,7 +614,7 @@ def create_test_circle_reisen(lp): title="Reflexion", parent=parent, ) - LearningContentFeedbackFactory( + LearningContentFeedbackUKFactory( parent=parent, ) diff --git a/server/vbv_lernwelt/course/creators/uk_course.py b/server/vbv_lernwelt/course/creators/uk_course.py index eb5bdc8f..64c03400 100644 --- a/server/vbv_lernwelt/course/creators/uk_course.py +++ b/server/vbv_lernwelt/course/creators/uk_course.py @@ -22,7 +22,7 @@ from vbv_lernwelt.learnpath.tests.learning_path_factories import ( LearningContentAttendanceCourseFactory, LearningContentDocumentListFactory, LearningContentEdoniqTestFactory, - LearningContentFeedbackFactory, + LearningContentFeedbackUKFactory, LearningContentMediaLibraryFactory, LearningContentPlaceholderFactory, LearningPathFactory, @@ -254,7 +254,7 @@ damit du erfolgreich mit deinem Lernpfad (durch-)starten kannst. title="Unterlagen für den Unterricht", parent=circle, ) - LearningContentFeedbackFactory( + LearningContentFeedbackUKFactory( parent=circle, ) LearningSequenceFactory(title="Transfer", parent=circle, icon="it-icon-ls-end") @@ -364,7 +364,7 @@ In diesem Circle erfährst du wie die überbetrieblichen Kurse aufgebaut sind. Z # test_url="https://exam.vbv-afa.ch/e-tutor/v4/user/course/pre_course_object?aid=1689096897473,2147466097", # ) LearningUnitFactory(title="Feedback", title_hidden=True, parent=circle) - LearningContentFeedbackFactory( + LearningContentFeedbackUKFactory( parent=circle, ) LearningSequenceFactory(title="Transfer", parent=circle, icon="it-icon-ls-end") @@ -479,7 +479,7 @@ Dans ce cercle, tu apprendras comment les cours interentreprises sont structuré test_url="https://exam.vbv-afa.ch/e-tutor/v4/user/course/pre_course_object?aid=1689096897473,2147466097", ) LearningUnitFactory(title="Feedback", title_hidden=True, parent=circle) - LearningContentFeedbackFactory( + LearningContentFeedbackUKFactory( parent=circle, ) LearningSequenceFactory(title="Transfert", parent=circle, icon="it-icon-ls-end") @@ -594,7 +594,7 @@ In questo Circle imparerai come sono strutturati i corsi interaziendali. Imparer test_url="https://exam.vbv-afa.ch/e-tutor/v4/user/course/pre_course_object?aid=1689096897473,2147466097", ) LearningUnitFactory(title="Feedback", title_hidden=True, parent=circle) - LearningContentFeedbackFactory( + LearningContentFeedbackUKFactory( parent=circle, ) LearningSequenceFactory(title="Trasferimento", parent=circle, icon="it-icon-ls-end") @@ -699,7 +699,7 @@ In diesem Circle lernst du die wichtigsten Grundlagen bezüglich Versicherungswi ], ) LearningUnitFactory(title="Feedback", title_hidden=True, parent=circle) - LearningContentFeedbackFactory( + LearningContentFeedbackUKFactory( parent=circle, ) LearningSequenceFactory(title="Transfer", parent=circle, icon="it-icon-ls-end") @@ -809,7 +809,7 @@ Dans ce cercle, tu apprends les bases les plus importantes en matière d'assuran ], ) LearningUnitFactory(title="Feedback", title_hidden=True, parent=circle) - LearningContentFeedbackFactory( + LearningContentFeedbackUKFactory( parent=circle, ) LearningSequenceFactory(title="Transfert", parent=circle, icon="it-icon-ls-end") @@ -918,7 +918,7 @@ In questo Circle imparerai le basi più importanti del settore assicurativo e de ], ) LearningUnitFactory(title="Feedback", title_hidden=True, parent=circle) - LearningContentFeedbackFactory( + LearningContentFeedbackUKFactory( parent=circle, ) LearningSequenceFactory(title="Trasferimento", parent=circle, icon="it-icon-ls-end") @@ -1058,7 +1058,7 @@ def create_uk_circle_fahrzeug(lp, title="Fahrzeug"): ], ) LearningUnitFactory(title="Feedback", title_hidden=True, parent=circle) - LearningContentFeedbackFactory( + LearningContentFeedbackUKFactory( parent=circle, ) @@ -1192,7 +1192,7 @@ def create_uk_fr_circle_fahrzeug(lp, title="Véhicule"): ], ) LearningUnitFactory(title="Feedback", title_hidden=True, parent=circle) - LearningContentFeedbackFactory( + LearningContentFeedbackUKFactory( parent=circle, ) @@ -1330,7 +1330,7 @@ def create_uk_it_circle_fahrzeug(lp, title="Veicolo"): ], ) LearningUnitFactory(title="Feedback", title_hidden=True, parent=circle) - LearningContentFeedbackFactory( + LearningContentFeedbackUKFactory( parent=circle, ) diff --git a/server/vbv_lernwelt/feedback/services.py b/server/vbv_lernwelt/feedback/services.py index 86460ea4..83f53599 100644 --- a/server/vbv_lernwelt/feedback/services.py +++ b/server/vbv_lernwelt/feedback/services.py @@ -1,10 +1,15 @@ +from typing import Union + import structlog from vbv_lernwelt.core.models import User from vbv_lernwelt.course.models import CourseCompletionStatus, CourseSession from vbv_lernwelt.course.services import mark_course_completion from vbv_lernwelt.feedback.models import FeedbackResponse -from vbv_lernwelt.learnpath.models import LearningContentFeedback +from vbv_lernwelt.learnpath.models import ( + LearningContentFeedbackUK, + LearningContentFeedbackVV, +) logger = structlog.get_logger(__name__) @@ -12,7 +17,9 @@ logger = structlog.get_logger(__name__) def update_feedback_response( feedback_user: User, course_session: CourseSession, - learning_content_feedback_page: LearningContentFeedback, + learning_content_feedback_page: Union[ + LearningContentFeedbackUK, LearningContentFeedbackVV + ], submitted: bool, validated_data: dict, ): diff --git a/server/vbv_lernwelt/learnpath/create_vv_new_learning_path.py b/server/vbv_lernwelt/learnpath/create_vv_new_learning_path.py index 6a55f618..915b2239 100644 --- a/server/vbv_lernwelt/learnpath/create_vv_new_learning_path.py +++ b/server/vbv_lernwelt/learnpath/create_vv_new_learning_path.py @@ -13,7 +13,7 @@ from vbv_lernwelt.course.models import CourseCategory, CoursePage from vbv_lernwelt.learnpath.tests.learning_path_factories import ( CircleFactory, LearningContentAssignmentFactory, - LearningContentFeedbackFactory, + LearningContentFeedbackVVFactory, LearningContentLearningModuleFactory, LearningContentMediaLibraryFactory, LearningContentPlaceholderFactory, @@ -201,7 +201,7 @@ def create_circle_basis(lp, title="Basis"): slug__startswith=f"versicherungsvermittler-in-assignment-reflexion" ), ), - LearningContentFeedbackFactory( + LearningContentFeedbackVVFactory( parent=circle, ) @@ -278,7 +278,7 @@ def create_circle_gewinnen(lp, title="Gewinnen"): slug__startswith=f"{course_slug}-assignment-reflexion" ), ), - LearningContentFeedbackFactory( + LearningContentFeedbackVVFactory( parent=circle, ) @@ -368,7 +368,7 @@ def create_circle_fahrzeug(lp, title="Fahrzeug"): # slug__startswith=f"{circle.get_course().slug}-assignment-reflexion" # ), # ), - LearningContentFeedbackFactory( + LearningContentFeedbackVVFactory( parent=circle, ) @@ -554,7 +554,7 @@ def create_circle_reisen(lp, title="Reisen"): slug__startswith=f"{circle.get_course().slug}-assignment-reflexion" ), ), - LearningContentFeedbackFactory( + LearningContentFeedbackVVFactory( parent=circle, ) @@ -647,7 +647,7 @@ def create_circle_einkommenssicherung(lp, title="Einkommenssicherung"): slug__startswith=f"{circle.get_course().slug}-assignment-reflexion" ), ), - LearningContentFeedbackFactory( + LearningContentFeedbackVVFactory( parent=circle, ) @@ -700,7 +700,7 @@ def create_circle_wohneigentum(lp, title="Wohneigentum"): slug__startswith=f"{circle.get_course().slug}-assignment-reflexion" ), ), - LearningContentFeedbackFactory( + LearningContentFeedbackVVFactory( parent=circle, ) @@ -782,7 +782,7 @@ def create_circle_pensionierung(lp, title="Pensionierung"): slug__startswith=f"{circle.get_course().slug}-assignment-reflexion" ), ), - LearningContentFeedbackFactory( + LearningContentFeedbackVVFactory( parent=circle, ) @@ -839,7 +839,7 @@ def create_circle_erben(lp, title="Erben/Vererben"): slug__startswith=f"{circle.get_course().slug}-assignment-reflexion" ), ), - LearningContentFeedbackFactory( + LearningContentFeedbackVVFactory( parent=circle, ) @@ -929,7 +929,7 @@ def create_circle_gesundheit(lp, title="Gesundheit"): slug__startswith=f"{circle.get_course().slug}-assignment-reflexion" ), ), - LearningContentFeedbackFactory( + LearningContentFeedbackVVFactory( parent=circle, ) @@ -1352,7 +1352,7 @@ def create_learning_sequence_transfer(parent, title, lc_praxis_title=None): slug__startswith=f"versicherungsvermittler-in-assignment-reflexion" ), ), - LearningContentFeedbackFactory( + LearningContentFeedbackVVFactory( parent=parent, ) diff --git a/server/vbv_lernwelt/learnpath/graphql/types.py b/server/vbv_lernwelt/learnpath/graphql/types.py index f00f282f..7e262abb 100644 --- a/server/vbv_lernwelt/learnpath/graphql/types.py +++ b/server/vbv_lernwelt/learnpath/graphql/types.py @@ -11,6 +11,7 @@ from vbv_lernwelt.learnpath.models import ( LearningContentDocumentList, LearningContentEdoniqTest, LearningContentFeedback, + LearningContentFeedbackUK, LearningContentFeedbackVV, LearningContentKnowledgeAssessment, LearningContentLearningModule, @@ -52,6 +53,8 @@ class LearningContentInterface(CoursePageInterface): return LearningContentAttendanceCourseObjectType elif isinstance(instance, LearningContentFeedback): return LearningContentFeedbackUKObjectType + elif isinstance(instance, LearningContentFeedbackUK): + return LearningContentFeedbackUKObjectType elif isinstance(instance, LearningContentFeedbackVV): return LearningContentFeedbackVVObjectType elif isinstance(instance, LearningContentLearningModule): @@ -110,7 +113,7 @@ class LearningContentPlaceholderObjectType(DjangoObjectType): class LearningContentFeedbackUKObjectType(DjangoObjectType): class Meta: - model = LearningContentFeedback + model = LearningContentFeedbackUK interfaces = ( CoursePageInterface, LearningContentInterface, diff --git a/server/vbv_lernwelt/learnpath/tests/learning_path_factories.py b/server/vbv_lernwelt/learnpath/tests/learning_path_factories.py index e882ecca..85b8f45b 100644 --- a/server/vbv_lernwelt/learnpath/tests/learning_path_factories.py +++ b/server/vbv_lernwelt/learnpath/tests/learning_path_factories.py @@ -7,7 +7,8 @@ from vbv_lernwelt.learnpath.models import ( LearningContentAttendanceCourse, LearningContentDocumentList, LearningContentEdoniqTest, - LearningContentFeedback, + LearningContentFeedbackUK, + LearningContentFeedbackVV, LearningContentKnowledgeAssessment, LearningContentLearningModule, LearningContentMediaLibrary, @@ -120,14 +121,24 @@ class LearningContentPlaceholderFactory(wagtail_factories.PageFactory): model = LearningContentPlaceholder -class LearningContentFeedbackFactory(wagtail_factories.PageFactory): - title = "Feedback" +class LearningContentFeedbackVVFactory(wagtail_factories.PageFactory): + title = "FeedbackVV" minutes = 0 content_url = "" description = RichText("") class Meta: - model = LearningContentFeedback + model = LearningContentFeedbackVV + + +class LearningContentFeedbackUKFactory(wagtail_factories.PageFactory): + title = "FeedbackUK" + minutes = 0 + content_url = "" + description = RichText("") + + class Meta: + model = LearningContentFeedbackUK class LearningContentLearningModuleFactory(wagtail_factories.PageFactory):