From a33c161231682109b0ea28392a1723602f90220b Mon Sep 17 00:00:00 2001 From: Daniel Egger Date: Tue, 4 Oct 2022 15:48:53 +0200 Subject: [PATCH] Add learning path data for oktober demo --- .../learnpath/create_default_learning_path.py | 118 ++++++++---------- .../0002_alter_learningcontent_contents.py | 20 +++ server/vbv_lernwelt/learnpath/models.py | 2 + .../learnpath/models_learning_unit_content.py | 8 ++ .../tests/learning_path_factories.py | 87 ++++++++----- .../tests/media_library_factories.py | 2 +- 6 files changed, 142 insertions(+), 95 deletions(-) create mode 100644 server/vbv_lernwelt/learnpath/migrations/0002_alter_learningcontent_contents.py diff --git a/server/vbv_lernwelt/learnpath/create_default_learning_path.py b/server/vbv_lernwelt/learnpath/create_default_learning_path.py index b5a13bf8..eaefddfe 100644 --- a/server/vbv_lernwelt/learnpath/create_default_learning_path.py +++ b/server/vbv_lernwelt/learnpath/create_default_learning_path.py @@ -30,46 +30,6 @@ def create_circle(title, learning_path): return CircleFactory( title=title, parent=learning_path, - description=""" - Nach dem Gespräch werten sie die Analyse aus und erstellen mit den - zur Verfügung stehenden Systemen formal korrekte Lösungsvorschläge bzw. - Ausschreibungen. Je nach Komplexität der Situation ziehen sie die nötigen - Fachspezialisten bei. - """, - job_situations=[ - ("job_situation", "Absicherung der Familie"), - ("job_situation", "Prämien einsparen"), - ("job_situation", "Deckung optimieren"), - ("job_situation", "Auto kaufen"), - ("job_situation", "Fahrzeugwechsel"), - ("job_situation", "Pensionerung inklusive Variante Frühpensionierung"), - ("job_situation", "Reisen"), - ], - goals=[ - ( - "goal", - "... die heutige Versicherungssituation von Privat- oder Geschäftskunden einzuschätzen.", - ), - ( - "goal", - "... deinem Kunden einen ungenügenden oder übermässigen Versicherungsschutz aufzuzeigen.", - ), - ( - "goal", - "... deinem Kunden zu helfen, sein Optimierungspotential voll auszuschöpfen.", - ), - ("goal", "... deinem Kunden seine optimale Lösung aufzuzeigen"), - ], - experts=[ - ( - "person", - { - "last_name": "Huggel", - "first_name": "Patrizia", - "email": "patrizia.huggel@example.com", - }, - ), - ], ) @@ -426,42 +386,68 @@ def create_default_learning_path(user=None, skip_locales=True): circle_basis = CircleFactory( title="Basis", parent=lp, - description=""" -In diesem Circle erklären wir dir, wie der Lehrgang -Versicherungsvermittler / in " aufgebaut ist. Zudem vermitteln wir dir die wichtigsten Grundlagen, -damit erfolgreich mit deinem Lernpfad starten kannst. -""", ) LearningSequenceFactory( title="Starten", parent=circle_basis, icon="it-icon-ls-start" ) + LearningUnitFactory(title="Einführung", parent=circle_basis) LearningContentFactory( - title='Einleitung Circle "Basis"', + title="Willkommen im Lehrgang Versicherungsvermitler VBV", parent=circle_basis, - minutes=15, - contents=[ - ( - "video", - VideoBlockFactory( - url="https://www.youtube.com/embed/qhPIfxS2hvI", - description="In dieser Circle zeigt dir ein Fachexperte anhand von Kundensituationen, wie du erfolgreich" - "den Kundenbedarf ermitteln, analysieren, priorisieren und anschliessend zusammenfassen kannst.", - ), - ) - ], ) + LearningUnitFactory(title="Arbeits- und Lerntechnik", parent=circle_basis) + LearningContentFactory( + title="Mediathek", + parent=circle_basis, + ) + LearningContentFactory( + title="Luca organisiert seinen Arbeitsalltag", + parent=circle_basis, + ) + LearningContentFactory( + title="Luca legt sich seine Lernstrategie zurecht", + parent=circle_basis, + ) + LearningContentFactory( + title="Fachcheck Arbeits- und Lerntechnik", + parent=circle_basis, + ) + + LearningSequenceFactory( + title="Grundlagen", parent=circle_basis, icon="it-icon-ls-watch" + ) + LearningUnitFactory(title="Versicherung", parent=circle_basis) + LearningContentFactory( + title="Mediathek", + parent=circle_basis, + ) + LearningContentFactory( + title="Luca startet durch", + parent=circle_basis, + ) + LearningContentFactory( + title="Fachcheck Allgemeines zu Versicherungen", + parent=circle_basis, + ) + LearningUnitFactory(title="Beratung und Verkauf", parent=circle_basis) + LearningContentFactory( + title="Mediathek", + parent=circle_basis, + ) + LearningContentFactory( + title="Luca macht sich fit im Verkauf", + parent=circle_basis, + ) + LearningContentFactory( + title="Fachcheck Beratung und Verkauf", + parent=circle_basis, + ) + LearningSequenceFactory(title="Beenden", parent=circle_basis, icon="it-icon-ls-end") + LearningUnitFactory(title="Jetzt kann's los gehen", parent=circle_basis) LearningContentFactory( - title="Kompetenzprofil anschauen", + title="Lerninhalt offen", parent=circle_basis, - minutes=30, - contents=[("document", DocumentBlockFactory())], - ) - LearningContentFactory( - title='Circle "Analyse" abschliessen', - parent=circle_basis, - minutes=30, - contents=[("document", DocumentBlockFactory())], ) TopicFactory(title="Gewinnen von Kunden", parent=lp) diff --git a/server/vbv_lernwelt/learnpath/migrations/0002_alter_learningcontent_contents.py b/server/vbv_lernwelt/learnpath/migrations/0002_alter_learningcontent_contents.py new file mode 100644 index 00000000..365bcf45 --- /dev/null +++ b/server/vbv_lernwelt/learnpath/migrations/0002_alter_learningcontent_contents.py @@ -0,0 +1,20 @@ +# Generated by Django 3.2.13 on 2022-10-04 13:34 + +from django.db import migrations +import wagtail.blocks +import wagtail.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('learnpath', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='learningcontent', + name='contents', + field=wagtail.fields.StreamField([('video', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.URLBlock())])), ('resource', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.URLBlock())])), ('exercise', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.URLBlock())])), ('online_training', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.URLBlock())])), ('media_library', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.URLBlock())])), ('document', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.URLBlock())])), ('test', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.URLBlock())])), ('book', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.URLBlock())])), ('assignment', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.URLBlock())])), ('placeholder', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.URLBlock())]))], use_json_field=None), + ), + ] diff --git a/server/vbv_lernwelt/learnpath/models.py b/server/vbv_lernwelt/learnpath/models.py index ac861d1c..bcf509a4 100644 --- a/server/vbv_lernwelt/learnpath/models.py +++ b/server/vbv_lernwelt/learnpath/models.py @@ -19,6 +19,7 @@ from vbv_lernwelt.learnpath.models_learning_unit_content import ( ResourceBlock, TestBlock, VideoBlock, + PlaceholderBlock, ) from vbv_lernwelt.learnpath.serializer_helpers import get_it_serializer_class @@ -272,6 +273,7 @@ class LearningContent(Page): ("test", TestBlock()), ("book", BookBlock()), ("assignment", AssignmentBlock()), + ("placeholder", PlaceholderBlock()), ] contents = StreamField( diff --git a/server/vbv_lernwelt/learnpath/models_learning_unit_content.py b/server/vbv_lernwelt/learnpath/models_learning_unit_content.py index cb3148f7..c0741e07 100644 --- a/server/vbv_lernwelt/learnpath/models_learning_unit_content.py +++ b/server/vbv_lernwelt/learnpath/models_learning_unit_content.py @@ -25,6 +25,14 @@ class DocumentBlock(blocks.StructBlock): icon = "media" +class PlaceholderBlock(blocks.StructBlock): + description = blocks.TextBlock() + url = blocks.URLBlock() + + class Meta: + icon = "media" + + class ExerciseBlock(blocks.StructBlock): description = blocks.TextBlock() url = blocks.URLBlock() diff --git a/server/vbv_lernwelt/learnpath/tests/learning_path_factories.py b/server/vbv_lernwelt/learnpath/tests/learning_path_factories.py index ff3beb3f..ddbb6867 100644 --- a/server/vbv_lernwelt/learnpath/tests/learning_path_factories.py +++ b/server/vbv_lernwelt/learnpath/tests/learning_path_factories.py @@ -18,6 +18,7 @@ from vbv_lernwelt.learnpath.models_learning_unit_content import ( ResourceBlock, TestBlock, VideoBlock, + PlaceholderBlock, ) @@ -36,34 +37,6 @@ class TopicFactory(wagtail_factories.PageFactory): model = Topic -class CircleFactory(wagtail_factories.PageFactory): - title = "Gewinnen" - - class Meta: - model = Circle - - -class LearningSequenceFactory(wagtail_factories.PageFactory): - title = "Grundlagen" - - class Meta: - model = LearningSequence - - -class LearningUnitFactory(wagtail_factories.PageFactory): - title = "Lerneinheit" - - class Meta: - model = LearningUnit - - -class LearningContentFactory(wagtail_factories.PageFactory): - title = "Lerninhalt" - - class Meta: - model = LearningContent - - class VideoBlockFactory(wagtail_factories.StructBlockFactory): url = "https://www.youtube.com/embed/qhPIfxS2hvI" description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam" @@ -93,6 +66,13 @@ class DocumentBlockFactory(wagtail_factories.StructBlockFactory): model = DocumentBlock +class PlaceholderBlockFactory(wagtail_factories.StructBlockFactory): + description = "Platzhalter" + + class Meta: + model = PlaceholderBlock + + class ExerciseBlockFactory(wagtail_factories.StructBlockFactory): description = "Beispiel Übung" @@ -127,3 +107,54 @@ class MediaLibraryBlockFactory(wagtail_factories.StructBlockFactory): class Meta: model = MediaLibraryBlock + + +class CircleFactory(wagtail_factories.PageFactory): + title = "Analyse" + description = """ +Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. +Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, +nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, +pretium quis, sem. Nulla consequat massa quis enim. Donec. + """.strip() + job_situations = [("job_situation", f"Job Situation {x + 1}") for x in range(7)] + goals = [ + ("goal", f"... hier ein Beispieltext für ein Ziel {x + 1}") for x in range(3) + ] + experts = [ + ( + "person", + { + "last_name": "Mustermann", + "first_name": "Patrizia", + "email": "patrizia.mustermann@example.com", + }, + ), + ] + + class Meta: + model = Circle + + +class LearningSequenceFactory(wagtail_factories.PageFactory): + title = "Anwenden" + icon = "it-icon-ls-apply" + + class Meta: + model = LearningSequence + + +class LearningUnitFactory(wagtail_factories.PageFactory): + title = "Fahrzeug" + + class Meta: + model = LearningUnit + + +class LearningContentFactory(wagtail_factories.PageFactory): + title = "Platzhalter Inhalt" + contents = [("placeholder", PlaceholderBlockFactory())] + minutes = 15 + + class Meta: + model = LearningContent diff --git a/server/vbv_lernwelt/media_library/tests/media_library_factories.py b/server/vbv_lernwelt/media_library/tests/media_library_factories.py index 0071830d..c498e73c 100644 --- a/server/vbv_lernwelt/media_library/tests/media_library_factories.py +++ b/server/vbv_lernwelt/media_library/tests/media_library_factories.py @@ -175,7 +175,7 @@ Nulla consequat massa quis enim. Donec. contents=[create_external_link_block() for _ in range(4)], ), create_media_collection( - title="Links", + title="Verankerung im Lernpfad", contents=[create_internal_link_block() for _ in range(3)], ), create_media_collection(