wip: Update course creation

This commit is contained in:
Christian Cueni 2023-11-29 16:47:42 +01:00
parent d1504f592d
commit 2e408643bc
7 changed files with 56 additions and 35 deletions

View File

@ -32,7 +32,7 @@ from vbv_lernwelt.course_session.services.attendance import AttendanceUserStatus
from vbv_lernwelt.feedback.models import FeedbackResponse from vbv_lernwelt.feedback.models import FeedbackResponse
from vbv_lernwelt.learnpath.models import ( from vbv_lernwelt.learnpath.models import (
LearningContentAttendanceCourse, LearningContentAttendanceCourse,
LearningContentFeedback, LearningContentFeedbackUK,
) )
from vbv_lernwelt.notify.models import Notification from vbv_lernwelt.notify.models import Notification
@ -155,8 +155,8 @@ def command(
if create_feedback_responses: if create_feedback_responses:
print("create_feedback_responses") print("create_feedback_responses")
course_session = CourseSession.objects.get(id=TEST_COURSE_SESSION_BERN_ID) course_session = CourseSession.objects.get(id=TEST_COURSE_SESSION_BERN_ID)
learning_content_feedback_page = LearningContentFeedback.objects.get( learning_content_feedback_page = LearningContentFeedbackUK.objects.get(
slug="test-lehrgang-lp-circle-fahrzeug-lc-feedback" slug="test-lehrgang-lp-circle-fahrzeug-lc-feedbackuk"
) )
create_feedback_response_data( create_feedback_response_data(
feedback_user=User.objects.get(id=TEST_STUDENT1_USER_ID), feedback_user=User.objects.get(id=TEST_STUDENT1_USER_ID),

View File

@ -70,7 +70,7 @@ from vbv_lernwelt.learnpath.tests.learning_path_factories import (
LearningContentAssignmentFactory, LearningContentAssignmentFactory,
LearningContentAttendanceCourseFactory, LearningContentAttendanceCourseFactory,
LearningContentEdoniqTestFactory, LearningContentEdoniqTestFactory,
LearningContentFeedbackFactory, LearningContentFeedbackUKFactory,
LearningContentKnowledgeAssessmentFactory, LearningContentKnowledgeAssessmentFactory,
LearningContentLearningModuleFactory, LearningContentLearningModuleFactory,
LearningContentMediaLibraryFactory, LearningContentMediaLibraryFactory,
@ -530,7 +530,7 @@ damit du erfolgreich mit deinem Lernpfad (durch-)starten kannst.
slug__startswith="test-lehrgang-assignment-überprüfen-einer-motorfahrzeugs" slug__startswith="test-lehrgang-assignment-überprüfen-einer-motorfahrzeugs"
), ),
) )
LearningContentFeedbackFactory( LearningContentFeedbackUKFactory(
parent=circle, parent=circle,
) )
@ -614,7 +614,7 @@ def create_test_circle_reisen(lp):
title="Reflexion", title="Reflexion",
parent=parent, parent=parent,
) )
LearningContentFeedbackFactory( LearningContentFeedbackUKFactory(
parent=parent, parent=parent,
) )

View File

@ -22,7 +22,7 @@ from vbv_lernwelt.learnpath.tests.learning_path_factories import (
LearningContentAttendanceCourseFactory, LearningContentAttendanceCourseFactory,
LearningContentDocumentListFactory, LearningContentDocumentListFactory,
LearningContentEdoniqTestFactory, LearningContentEdoniqTestFactory,
LearningContentFeedbackFactory, LearningContentFeedbackUKFactory,
LearningContentMediaLibraryFactory, LearningContentMediaLibraryFactory,
LearningContentPlaceholderFactory, LearningContentPlaceholderFactory,
LearningPathFactory, LearningPathFactory,
@ -254,7 +254,7 @@ damit du erfolgreich mit deinem Lernpfad (durch-)starten kannst.
title="Unterlagen für den Unterricht", title="Unterlagen für den Unterricht",
parent=circle, parent=circle,
) )
LearningContentFeedbackFactory( LearningContentFeedbackUKFactory(
parent=circle, parent=circle,
) )
LearningSequenceFactory(title="Transfer", parent=circle, icon="it-icon-ls-end") 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", # 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) LearningUnitFactory(title="Feedback", title_hidden=True, parent=circle)
LearningContentFeedbackFactory( LearningContentFeedbackUKFactory(
parent=circle, parent=circle,
) )
LearningSequenceFactory(title="Transfer", parent=circle, icon="it-icon-ls-end") 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", 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) LearningUnitFactory(title="Feedback", title_hidden=True, parent=circle)
LearningContentFeedbackFactory( LearningContentFeedbackUKFactory(
parent=circle, parent=circle,
) )
LearningSequenceFactory(title="Transfert", parent=circle, icon="it-icon-ls-end") 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", 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) LearningUnitFactory(title="Feedback", title_hidden=True, parent=circle)
LearningContentFeedbackFactory( LearningContentFeedbackUKFactory(
parent=circle, parent=circle,
) )
LearningSequenceFactory(title="Trasferimento", parent=circle, icon="it-icon-ls-end") 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) LearningUnitFactory(title="Feedback", title_hidden=True, parent=circle)
LearningContentFeedbackFactory( LearningContentFeedbackUKFactory(
parent=circle, parent=circle,
) )
LearningSequenceFactory(title="Transfer", parent=circle, icon="it-icon-ls-end") 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) LearningUnitFactory(title="Feedback", title_hidden=True, parent=circle)
LearningContentFeedbackFactory( LearningContentFeedbackUKFactory(
parent=circle, parent=circle,
) )
LearningSequenceFactory(title="Transfert", parent=circle, icon="it-icon-ls-end") 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) LearningUnitFactory(title="Feedback", title_hidden=True, parent=circle)
LearningContentFeedbackFactory( LearningContentFeedbackUKFactory(
parent=circle, parent=circle,
) )
LearningSequenceFactory(title="Trasferimento", parent=circle, icon="it-icon-ls-end") 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) LearningUnitFactory(title="Feedback", title_hidden=True, parent=circle)
LearningContentFeedbackFactory( LearningContentFeedbackUKFactory(
parent=circle, parent=circle,
) )
@ -1192,7 +1192,7 @@ def create_uk_fr_circle_fahrzeug(lp, title="Véhicule"):
], ],
) )
LearningUnitFactory(title="Feedback", title_hidden=True, parent=circle) LearningUnitFactory(title="Feedback", title_hidden=True, parent=circle)
LearningContentFeedbackFactory( LearningContentFeedbackUKFactory(
parent=circle, parent=circle,
) )
@ -1330,7 +1330,7 @@ def create_uk_it_circle_fahrzeug(lp, title="Veicolo"):
], ],
) )
LearningUnitFactory(title="Feedback", title_hidden=True, parent=circle) LearningUnitFactory(title="Feedback", title_hidden=True, parent=circle)
LearningContentFeedbackFactory( LearningContentFeedbackUKFactory(
parent=circle, parent=circle,
) )

View File

@ -1,10 +1,15 @@
from typing import Union
import structlog import structlog
from vbv_lernwelt.core.models import User from vbv_lernwelt.core.models import User
from vbv_lernwelt.course.models import CourseCompletionStatus, CourseSession from vbv_lernwelt.course.models import CourseCompletionStatus, CourseSession
from vbv_lernwelt.course.services import mark_course_completion from vbv_lernwelt.course.services import mark_course_completion
from vbv_lernwelt.feedback.models import FeedbackResponse 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__) logger = structlog.get_logger(__name__)
@ -12,7 +17,9 @@ logger = structlog.get_logger(__name__)
def update_feedback_response( def update_feedback_response(
feedback_user: User, feedback_user: User,
course_session: CourseSession, course_session: CourseSession,
learning_content_feedback_page: LearningContentFeedback, learning_content_feedback_page: Union[
LearningContentFeedbackUK, LearningContentFeedbackVV
],
submitted: bool, submitted: bool,
validated_data: dict, validated_data: dict,
): ):

View File

@ -13,7 +13,7 @@ from vbv_lernwelt.course.models import CourseCategory, CoursePage
from vbv_lernwelt.learnpath.tests.learning_path_factories import ( from vbv_lernwelt.learnpath.tests.learning_path_factories import (
CircleFactory, CircleFactory,
LearningContentAssignmentFactory, LearningContentAssignmentFactory,
LearningContentFeedbackFactory, LearningContentFeedbackVVFactory,
LearningContentLearningModuleFactory, LearningContentLearningModuleFactory,
LearningContentMediaLibraryFactory, LearningContentMediaLibraryFactory,
LearningContentPlaceholderFactory, LearningContentPlaceholderFactory,
@ -201,7 +201,7 @@ def create_circle_basis(lp, title="Basis"):
slug__startswith=f"versicherungsvermittler-in-assignment-reflexion" slug__startswith=f"versicherungsvermittler-in-assignment-reflexion"
), ),
), ),
LearningContentFeedbackFactory( LearningContentFeedbackVVFactory(
parent=circle, parent=circle,
) )
@ -278,7 +278,7 @@ def create_circle_gewinnen(lp, title="Gewinnen"):
slug__startswith=f"{course_slug}-assignment-reflexion" slug__startswith=f"{course_slug}-assignment-reflexion"
), ),
), ),
LearningContentFeedbackFactory( LearningContentFeedbackVVFactory(
parent=circle, parent=circle,
) )
@ -368,7 +368,7 @@ def create_circle_fahrzeug(lp, title="Fahrzeug"):
# slug__startswith=f"{circle.get_course().slug}-assignment-reflexion" # slug__startswith=f"{circle.get_course().slug}-assignment-reflexion"
# ), # ),
# ), # ),
LearningContentFeedbackFactory( LearningContentFeedbackVVFactory(
parent=circle, parent=circle,
) )
@ -554,7 +554,7 @@ def create_circle_reisen(lp, title="Reisen"):
slug__startswith=f"{circle.get_course().slug}-assignment-reflexion" slug__startswith=f"{circle.get_course().slug}-assignment-reflexion"
), ),
), ),
LearningContentFeedbackFactory( LearningContentFeedbackVVFactory(
parent=circle, parent=circle,
) )
@ -647,7 +647,7 @@ def create_circle_einkommenssicherung(lp, title="Einkommenssicherung"):
slug__startswith=f"{circle.get_course().slug}-assignment-reflexion" slug__startswith=f"{circle.get_course().slug}-assignment-reflexion"
), ),
), ),
LearningContentFeedbackFactory( LearningContentFeedbackVVFactory(
parent=circle, parent=circle,
) )
@ -700,7 +700,7 @@ def create_circle_wohneigentum(lp, title="Wohneigentum"):
slug__startswith=f"{circle.get_course().slug}-assignment-reflexion" slug__startswith=f"{circle.get_course().slug}-assignment-reflexion"
), ),
), ),
LearningContentFeedbackFactory( LearningContentFeedbackVVFactory(
parent=circle, parent=circle,
) )
@ -782,7 +782,7 @@ def create_circle_pensionierung(lp, title="Pensionierung"):
slug__startswith=f"{circle.get_course().slug}-assignment-reflexion" slug__startswith=f"{circle.get_course().slug}-assignment-reflexion"
), ),
), ),
LearningContentFeedbackFactory( LearningContentFeedbackVVFactory(
parent=circle, parent=circle,
) )
@ -839,7 +839,7 @@ def create_circle_erben(lp, title="Erben/Vererben"):
slug__startswith=f"{circle.get_course().slug}-assignment-reflexion" slug__startswith=f"{circle.get_course().slug}-assignment-reflexion"
), ),
), ),
LearningContentFeedbackFactory( LearningContentFeedbackVVFactory(
parent=circle, parent=circle,
) )
@ -929,7 +929,7 @@ def create_circle_gesundheit(lp, title="Gesundheit"):
slug__startswith=f"{circle.get_course().slug}-assignment-reflexion" slug__startswith=f"{circle.get_course().slug}-assignment-reflexion"
), ),
), ),
LearningContentFeedbackFactory( LearningContentFeedbackVVFactory(
parent=circle, parent=circle,
) )
@ -1352,7 +1352,7 @@ def create_learning_sequence_transfer(parent, title, lc_praxis_title=None):
slug__startswith=f"versicherungsvermittler-in-assignment-reflexion" slug__startswith=f"versicherungsvermittler-in-assignment-reflexion"
), ),
), ),
LearningContentFeedbackFactory( LearningContentFeedbackVVFactory(
parent=parent, parent=parent,
) )

View File

@ -11,6 +11,7 @@ from vbv_lernwelt.learnpath.models import (
LearningContentDocumentList, LearningContentDocumentList,
LearningContentEdoniqTest, LearningContentEdoniqTest,
LearningContentFeedback, LearningContentFeedback,
LearningContentFeedbackUK,
LearningContentFeedbackVV, LearningContentFeedbackVV,
LearningContentKnowledgeAssessment, LearningContentKnowledgeAssessment,
LearningContentLearningModule, LearningContentLearningModule,
@ -52,6 +53,8 @@ class LearningContentInterface(CoursePageInterface):
return LearningContentAttendanceCourseObjectType return LearningContentAttendanceCourseObjectType
elif isinstance(instance, LearningContentFeedback): elif isinstance(instance, LearningContentFeedback):
return LearningContentFeedbackUKObjectType return LearningContentFeedbackUKObjectType
elif isinstance(instance, LearningContentFeedbackUK):
return LearningContentFeedbackUKObjectType
elif isinstance(instance, LearningContentFeedbackVV): elif isinstance(instance, LearningContentFeedbackVV):
return LearningContentFeedbackVVObjectType return LearningContentFeedbackVVObjectType
elif isinstance(instance, LearningContentLearningModule): elif isinstance(instance, LearningContentLearningModule):
@ -110,7 +113,7 @@ class LearningContentPlaceholderObjectType(DjangoObjectType):
class LearningContentFeedbackUKObjectType(DjangoObjectType): class LearningContentFeedbackUKObjectType(DjangoObjectType):
class Meta: class Meta:
model = LearningContentFeedback model = LearningContentFeedbackUK
interfaces = ( interfaces = (
CoursePageInterface, CoursePageInterface,
LearningContentInterface, LearningContentInterface,

View File

@ -7,7 +7,8 @@ from vbv_lernwelt.learnpath.models import (
LearningContentAttendanceCourse, LearningContentAttendanceCourse,
LearningContentDocumentList, LearningContentDocumentList,
LearningContentEdoniqTest, LearningContentEdoniqTest,
LearningContentFeedback, LearningContentFeedbackUK,
LearningContentFeedbackVV,
LearningContentKnowledgeAssessment, LearningContentKnowledgeAssessment,
LearningContentLearningModule, LearningContentLearningModule,
LearningContentMediaLibrary, LearningContentMediaLibrary,
@ -120,14 +121,24 @@ class LearningContentPlaceholderFactory(wagtail_factories.PageFactory):
model = LearningContentPlaceholder model = LearningContentPlaceholder
class LearningContentFeedbackFactory(wagtail_factories.PageFactory): class LearningContentFeedbackVVFactory(wagtail_factories.PageFactory):
title = "Feedback" title = "FeedbackVV"
minutes = 0 minutes = 0
content_url = "" content_url = ""
description = RichText("") description = RichText("")
class Meta: 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): class LearningContentLearningModuleFactory(wagtail_factories.PageFactory):