Refactor circle data model

This commit is contained in:
Daniel Egger 2022-06-08 12:38:15 +02:00
parent 4cac282dc8
commit ff23e3b4f7
10 changed files with 226 additions and 201 deletions

View File

@ -16,21 +16,20 @@ defineProps(['learningSequence'])
<div class="bg-white px-4 border border-gray-500 border-l-4 border-l-sky-500"> <div class="bg-white px-4 border border-gray-500 border-l-4 border-l-sky-500">
<div <div
v-for="learningPackage in learningSequence.learningPackages" v-for="learningUnit in learningSequence.learningUnits"
class="py-3" class="py-3"
> >
<div class="pb-3 flex gap-4" v-if="learningPackage.title"> <div class="pb-3 flex gap-4" v-if="learningUnit.title">
<div class="font-bold">{{ learningPackage.title }}</div> <div class="font-bold">{{ learningUnit.title }}</div>
<div>{{ learningPackage.minutes }} Minuten</div> <div>{{ learningUnit.minutes }} Minuten</div>
</div> </div>
<div <div
v-for="learningUnit in learningPackage.learningUnits" v-for="learningContent in learningUnit.learningContents"
class="flex items-center gap-4 pb-3" class="flex items-center gap-4 pb-3"
> >
<it-icon-smiley-neutral v-if="learningUnit.contents[0].type === 'self_evaluation'"/> <it-icon-checkbox-unchecked/>
<it-icon-checkbox-unchecked v-else/> <div>{{ learningContent.contents[0].type }}: {{ learningContent.title }}</div>
<div>{{ learningUnit.contents[0].type }}: {{ learningUnit.title }}</div>
</div> </div>
<hr class="-mx-4 text-gray-500"> <hr class="-mx-4 text-gray-500">

View File

@ -24,44 +24,45 @@ export default {
log.debug(response.data); log.debug(response.data);
this.circleData = response.data; this.circleData = response.data;
// aggregate wagtail data into LearningSequence > LearningPackages > LearningUnit hierarchy // aggregate wagtail data into LearningSequence > LearningUnit > LearningPackage hierarchy
let learningSequence = null; let learningSequence = null;
let learningPackageIndex = 0; let learningUnit = null;
this.circleData.children.forEach((child) => { this.circleData.children.forEach((child) => {
// FIXME add error detection if the data does not conform to expectations
if (child.type === 'learnpath.LearningSequence') { if (child.type === 'learnpath.LearningSequence') {
if (learningSequence) { if (learningSequence) {
if (learningUnit) {
learningSequence.learningUnits.push(learningUnit);
}
this.learningSequences.push(learningSequence); this.learningSequences.push(learningSequence);
} }
learningSequence = Object.assign(child, { learningPackages: [] }); learningSequence = Object.assign(child, { learningUnits: [] });
learningPackageIndex = 0; learningUnit = {id: null, title: '', learningContents: []};
} else if(child.type === 'learnpath.LearningUnit') {
if (learningUnit && learningUnit.learningContents.length) {
learningSequence.learningUnits.push(learningUnit);
}
learningUnit = Object.assign(child, { learningContents: [] });
} else { } else {
if (learningSequence.learningPackages.length === 0) { // must be a LearningContent
learningSequence.learningPackages.push({ learningUnit.learningContents.push(child);
title: child.package,
learningUnits: [],
})
}
if (learningSequence.learningPackages[learningPackageIndex].title !== child.package) {
learningPackageIndex += 1;
learningSequence.learningPackages.push({
title: child.package,
learningUnits: [],
})
}
learningSequence.learningPackages[learningPackageIndex].learningUnits.push(child);
} }
}); });
if (learningUnit) {
learningSequence.learningUnits.push(learningUnit);
}
this.learningSequences.push(learningSequence); this.learningSequences.push(learningSequence);
// sum minutes // sum minutes
this.learningSequences.forEach((learningSequence) => { this.learningSequences.forEach((learningSequence) => {
learningSequence.minutes = 0; learningSequence.minutes = 0;
learningSequence.learningPackages.forEach((learningPackage) => { learningSequence.learningUnits.forEach((learningUnit) => {
learningPackage.minutes = 0; learningUnit.minutes = 0;
learningPackage.learningUnits.forEach((learningUnit) => { learningUnit.learningContents.forEach((learningContent) => {
learningPackage.minutes += learningUnit.minutes; learningUnit.minutes += learningContent.minutes;
}); });
learningSequence.minutes += learningPackage.minutes; learningSequence.minutes += learningUnit.minutes;
}); });
}); });

View File

@ -1,10 +1,11 @@
# Generated by Django 3.2.12 on 2022-06-08 08:34 # Generated by Django 3.2.13 on 2022-06-08 12:08
from django.db import migrations, models from django.db import migrations, models
import django.db.models.deletion import django.db.models.deletion
import modelcluster.fields import modelcluster.fields
import wagtail.blocks import wagtail.blocks
import wagtail.fields import wagtail.fields
import wagtail.images.blocks
class Migration(migrations.Migration): class Migration(migrations.Migration):
@ -12,22 +13,10 @@ class Migration(migrations.Migration):
initial = True initial = True
dependencies = [ dependencies = [
('wagtailcore', '0066_collection_management_permissions'), ('wagtailcore', '0069_log_entry_jsonfield'),
] ]
operations = [ operations = [
migrations.CreateModel(
name='Circle',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')),
('description', models.TextField(blank=True, default='')),
('goals', models.TextField(blank=True, default='')),
],
options={
'verbose_name': 'Circle',
},
bases=('wagtailcore.page',),
),
migrations.CreateModel( migrations.CreateModel(
name='Competence', name='Competence',
fields=[ fields=[
@ -50,6 +39,18 @@ class Migration(migrations.Migration):
}, },
bases=('wagtailcore.page',), bases=('wagtailcore.page',),
), ),
migrations.CreateModel(
name='LearningContent',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')),
('minutes', models.PositiveIntegerField(default=15)),
('contents', wagtail.fields.StreamField([('video', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.URLBlock())])), ('web_based_training', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.URLBlock())])), ('podcast', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.URLBlock())])), ('competence', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock())])), ('exercise', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock())])), ('document', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock())])), ('knowledge', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock())]))], use_json_field=None)),
],
options={
'verbose_name': 'Learning Unit',
},
bases=('wagtailcore.page',),
),
migrations.CreateModel( migrations.CreateModel(
name='LearningPath', name='LearningPath',
fields=[ fields=[
@ -64,7 +65,7 @@ class Migration(migrations.Migration):
name='LearningSequence', name='LearningSequence',
fields=[ fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')), ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')),
('icon', models.CharField(default='IconLsStart', max_length=255)), ('icon', models.CharField(default='it-icon-ls-start', max_length=255)),
], ],
options={ options={
'verbose_name': 'Learning Sequence', 'verbose_name': 'Learning Sequence',
@ -75,9 +76,7 @@ class Migration(migrations.Migration):
name='LearningUnit', name='LearningUnit',
fields=[ fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')), ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')),
('minutes', models.PositiveIntegerField(default=15)), ('questions', wagtail.fields.StreamField([('question', wagtail.blocks.CharBlock())], use_json_field=True)),
('package', models.CharField(blank=True, default='', max_length=255)),
('contents', wagtail.fields.StreamField([('video', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.URLBlock())])), ('rise_training', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.URLBlock())])), ('podcast', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.URLBlock())])), ('competence', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock())])), ('exercise', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock())])), ('self_evaluation', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock())])), ('document', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock())])), ('knowledge', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock())]))])),
], ],
options={ options={
'verbose_name': 'Learning Unit', 'verbose_name': 'Learning Unit',
@ -87,13 +86,15 @@ class Migration(migrations.Migration):
migrations.CreateModel( migrations.CreateModel(
name='Topic', name='Topic',
fields=[ fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')), ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('title', models.TextField(default='')),
('is_visible', models.BooleanField(default=True)), ('is_visible', models.BooleanField(default=True)),
('learning_path', modelcluster.fields.ParentalKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='topics', to='learnpath.learningpath')),
], ],
options={ options={
'verbose_name': 'Topic', 'verbose_name': 'Topic',
}, },
bases=('wagtailcore.page',),
), ),
migrations.CreateModel( migrations.CreateModel(
name='FullfillmentCriteria', name='FullfillmentCriteria',
@ -112,4 +113,19 @@ class Migration(migrations.Migration):
name='competence_page', name='competence_page',
field=modelcluster.fields.ParentalKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='competences', to='learnpath.competencepage'), field=modelcluster.fields.ParentalKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='competences', to='learnpath.competencepage'),
), ),
migrations.CreateModel(
name='Circle',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')),
('description', models.TextField(blank=True, default='')),
('goals', wagtail.fields.StreamField([('goal', wagtail.blocks.TextBlock())], use_json_field=True)),
('job_situations', wagtail.fields.StreamField([('job_situation', wagtail.blocks.CharBlock())], use_json_field=True)),
('experts', wagtail.fields.StreamField([('person', wagtail.blocks.StructBlock([('first_name', wagtail.blocks.CharBlock()), ('last_name', wagtail.blocks.CharBlock()), ('email', wagtail.blocks.EmailBlock()), ('photo', wagtail.images.blocks.ImageChooserBlock(required=False)), ('biography', wagtail.blocks.RichTextBlock(required=False))]))], use_json_field=True)),
('topic', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='circles', to='learnpath.topic')),
],
options={
'verbose_name': 'Circle',
},
bases=('wagtailcore.page',),
),
] ]

View File

@ -1,14 +1,16 @@
# Create your models here. # Create your models here.
from django.utils.text import slugify from django.utils.text import slugify
from wagtail import blocks
from wagtail.api import APIField from wagtail.api import APIField
from wagtail.blocks import StreamBlock from wagtail.blocks import StreamBlock
from wagtail.fields import StreamField from wagtail.fields import StreamField
from wagtail.images.blocks import ImageChooserBlock
from wagtail.models import Page, Orderable from wagtail.models import Page, Orderable
from vbv_lernwelt.learnpath.models_competences import * from vbv_lernwelt.learnpath.models_competences import *
from vbv_lernwelt.learnpath.models_learning_unit_content import RiseTrainingBlock, VideoBlock, PodcastBlock, \ from vbv_lernwelt.learnpath.models_learning_unit_content import WebBasedTrainingBlock, VideoBlock, PodcastBlock, \
CompetenceBlock, ExerciseBlock, SelfEvaluationBlock, DocumentBlock, KnowledgeBlock CompetenceBlock, ExerciseBlock, DocumentBlock, KnowledgeBlock
from vbv_lernwelt.learnpath.serializer_helpers import get_it_serializer_class from vbv_lernwelt.learnpath.serializer_helpers import get_it_serializer_class
@ -65,9 +67,28 @@ class Topic(Page):
return f"{self.title}" return f"{self.title}"
class PersonBlock(blocks.StructBlock):
first_name = blocks.CharBlock()
last_name = blocks.CharBlock()
email = blocks.EmailBlock()
photo = ImageChooserBlock(required=False)
biography = blocks.RichTextBlock(required=False)
class Meta:
icon = 'user'
class Circle(Page): class Circle(Page):
description = models.TextField(default="", blank=True) description = models.TextField(default="", blank=True)
goals = models.TextField(default="", blank=True) goals = StreamField([
('goal', blocks.TextBlock()),
], use_json_field=True)
job_situations = StreamField([
('job_situation', blocks.CharBlock()),
], use_json_field=True)
experts = StreamField([
('person', PersonBlock()),
], use_json_field=True)
parent_page_types = ['learnpath.LearningPath'] parent_page_types = ['learnpath.LearningPath']
subpage_types = ['learnpath.LearningSequence', 'learnpath.LearningUnit'] subpage_types = ['learnpath.LearningSequence', 'learnpath.LearningUnit']
@ -75,11 +96,8 @@ class Circle(Page):
content_panels = Page.content_panels + [ content_panels = Page.content_panels + [
FieldPanel('description'), FieldPanel('description'),
FieldPanel('goals'), FieldPanel('goals'),
] FieldPanel('job_situations'),
FieldPanel('experts'),
api_fields = [
APIField('title'),
APIField('description'),
APIField('learning_sequences'), APIField('learning_sequences'),
] ]
@ -103,12 +121,12 @@ class Circle(Page):
class LearningSequence(Page): class LearningSequence(Page):
icon = models.CharField(max_length=255, default="IconLsStart")
parent_page_types = ['learnpath.Circle'] parent_page_types = ['learnpath.Circle']
subpage_types = []
panels = [ icon = models.CharField(max_length=255, default="it-icon-ls-start")
FieldPanel('title'),
content_panels = Page.content_panels + [
FieldPanel('icon'), FieldPanel('icon'),
] ]
@ -120,7 +138,7 @@ class LearningSequence(Page):
@classmethod @classmethod
def get_serializer_class(cls): def get_serializer_class(cls):
return get_it_serializer_class(cls, field_names=['id', 'title', 'icon', 'slug', 'type', 'translation_key']) return get_it_serializer_class(cls, field_names=['id', 'title', 'slug', 'type', 'translation_key', 'icon'])
def get_admin_display_title(self): def get_admin_display_title(self):
return f'{self.icon} {self.draft_title}' return f'{self.icon} {self.draft_title}'
@ -130,23 +148,40 @@ class LearningSequence(Page):
class LearningUnit(Page): class LearningUnit(Page):
"""
This is a group of contents, with the übung and test it is one unit. ... more of a structural charactacter.
"""
# TODO: Review model architecture, is the stream field the right thing here?
parent_page_types = ['learnpath.Circle'] parent_page_types = ['learnpath.Circle']
subpage_types = [] subpage_types = []
questions = StreamField([
('question', blocks.CharBlock()),
], use_json_field=True)
content_panels = Page.content_panels + [
FieldPanel('questions'),
]
class Meta:
verbose_name = "Learning Unit"
def __str__(self):
return f"{self.title}"
@classmethod
def get_serializer_class(cls):
return get_it_serializer_class(cls, field_names=['id', 'title', 'slug', 'type', 'translation_key', 'questions'])
class LearningContent(Page):
parent_page_types = ['learnpath.Circle']
subpage_types = []
minutes = models.PositiveIntegerField(default=15) minutes = models.PositiveIntegerField(default=15)
package = models.CharField(max_length=255, default="", blank=True)
content_blocks = [ content_blocks = [
('video', VideoBlock()), ('video', VideoBlock()),
('rise_training', RiseTrainingBlock()), ('web_based_training', WebBasedTrainingBlock()),
('podcast', PodcastBlock()), ('podcast', PodcastBlock()),
('competence', CompetenceBlock()), ('competence', CompetenceBlock()),
('exercise', ExerciseBlock()), ('exercise', ExerciseBlock()),
('self_evaluation', SelfEvaluationBlock()),
('document', DocumentBlock()), ('document', DocumentBlock()),
('knowledge', KnowledgeBlock()), ('knowledge', KnowledgeBlock()),
] ]
@ -164,9 +199,6 @@ class LearningUnit(Page):
def get_admin_display_title(self): def get_admin_display_title(self):
display_title = '' display_title = ''
if self.package:
display_title += f'{self.package}: '
if len(self.contents) > 0: if len(self.contents) > 0:
display_title += f'{self.contents[0].block_type.capitalize()}: ' display_title += f'{self.contents[0].block_type.capitalize()}: '
@ -178,14 +210,14 @@ class LearningUnit(Page):
verbose_name = "Learning Unit" verbose_name = "Learning Unit"
def full_clean(self, *args, **kwargs): def full_clean(self, *args, **kwargs):
self.slug = find_available_slug(LearningUnit, slugify(self.title, allow_unicode=True)) self.slug = find_available_slug(LearningContent, slugify(self.title, allow_unicode=True))
super(LearningUnit, self).full_clean(*args, **kwargs) super(LearningContent, self).full_clean(*args, **kwargs)
@classmethod @classmethod
def get_serializer_class(cls): def get_serializer_class(cls):
return get_it_serializer_class(cls, return get_it_serializer_class(cls,
field_names=['id', 'title', 'minutes', 'package', 'contents', 'slug', 'type', field_names=['id', 'title', 'slug', 'type',
'translation_key']) 'translation_key', 'minutes', 'contents'])
def __str__(self): def __str__(self):
return f"{self.title}" return f"{self.title}"

View File

@ -10,7 +10,7 @@ class VideoBlock(blocks.StructBlock):
icon = 'media' icon = 'media'
class RiseTrainingBlock(blocks.StructBlock): class WebBasedTrainingBlock(blocks.StructBlock):
description = blocks.TextBlock() description = blocks.TextBlock()
url = blocks.URLBlock() url = blocks.URLBlock()
@ -40,13 +40,6 @@ class ExerciseBlock(blocks.StructBlock):
icon = 'media' icon = 'media'
class SelfEvaluationBlock(blocks.StructBlock):
description = blocks.TextBlock()
class Meta:
icon = 'media'
class DocumentBlock(blocks.StructBlock): class DocumentBlock(blocks.StructBlock):
description = blocks.TextBlock() description = blocks.TextBlock()

View File

@ -17,7 +17,10 @@ class CircleSerializer(get_it_serializer_class(Circle, [])):
class Meta: class Meta:
model = Circle model = Circle
fields = ['id', 'title', 'slug', 'children', 'type'] fields = [
'id', 'title', 'slug', 'type', 'translation_key',
'children', 'description', 'job_situations', 'goals', 'experts',
]
class LearningPathSerializer(get_it_serializer_class(LearningPath, [])): class LearningPathSerializer(get_it_serializer_class(LearningPath, [])):

View File

@ -3,10 +3,10 @@ from django.conf import settings
from wagtail.models import Site, Page from wagtail.models import Site, Page
from vbv_lernwelt.core.admin import User from vbv_lernwelt.core.admin import User
from vbv_lernwelt.learnpath.models import LearningPath, Topic, Circle, LearningSequence, LearningUnit from vbv_lernwelt.learnpath.models import LearningPath, Topic, Circle, LearningSequence, LearningContent
from vbv_lernwelt.learnpath.tests.learning_path_factories import LearningPathFactory, TopicFactory, CircleFactory, \ from vbv_lernwelt.learnpath.tests.learning_path_factories import LearningPathFactory, TopicFactory, CircleFactory, \
LearningSequenceFactory, LearningUnitFactory, VideoBlockFactory, PodcastBlockFactory, CompetenceBlockFactory, \ LearningSequenceFactory, LearningContentFactory, VideoBlockFactory, PodcastBlockFactory, CompetenceBlockFactory, \
ExerciseBlockFactory, SelfEvaluationBlockFactory, DocumentBlockFactory ExerciseBlockFactory, DocumentBlockFactory, LearningUnitFactory
def create_default_learning_path(user=None): def create_default_learning_path(user=None):
@ -28,194 +28,175 @@ def create_default_learning_path(user=None):
tp = TopicFactory(title="Basissdf", is_visible=False, parent=lp) tp = TopicFactory(title="Basissdf", is_visible=False, parent=lp)
circle_1 = CircleFactory(title="Basis", parent=lp, description=""" circle_1 = CircleFactory(
title="Basis",
parent=lp,
description="""
In diesem Circle erklären wir dir, wie der Lehrgang In diesem Circle erklären wir dir, wie der Lehrgang
Versicherungsvermittler / in " aufgebaut ist. Zudem vermitteln wir dir die wichtigsten Grundlagen, Versicherungsvermittler / in " aufgebaut ist. Zudem vermitteln wir dir die wichtigsten Grundlagen,
damit erfolgreich mit deinem Lernpfad starten kannst.""") damit erfolgreich mit deinem Lernpfad starten kannst.
""")
tp = TopicFactory(title="Gewinnen von Kunden", parent=lp) tp = TopicFactory(title="Gewinnen von Kunden", parent=lp)
circle_2 = CircleFactory(title="Gewinnen", parent=lp, description="""Versicherungsvermittlerinnen und -vermittler verfügen über circle_2 = CircleFactory(
title="Gewinnen",
parent=lp,
description="""
Versicherungsvermittlerinnen und -vermittler verfügen über
ein starkes Netzwerk, das sie gezielt pflegen und ausbauen. Sie beraten und betreuen ihre bestehenden Kundinnen und Kunden professionell und gewinnen so ihr Vertrauen. Dadurch schaffen sie die Basis für das Gewinnen ein starkes Netzwerk, das sie gezielt pflegen und ausbauen. Sie beraten und betreuen ihre bestehenden Kundinnen und Kunden professionell und gewinnen so ihr Vertrauen. Dadurch schaffen sie die Basis für das Gewinnen
von neuen Kundinnen und Kunden. Versicherungsvermittlerinnen und -vermittler sprechen ihre bestehenden Kundinnen von neuen Kundinnen und Kunden. Versicherungsvermittlerinnen und -vermittler sprechen ihre bestehenden Kundinnen
und Kunden auf Weiterempfehlung an. So nutzen sie ihre und Kunden auf Weiterempfehlung an. So nutzen sie ihre
bestehenden Kontakte geschickt für das Anwerben von bestehenden Kontakte geschickt für das Anwerben von
Neukundinnen und -kunden. Neukundinnen und -kunden.""",
""", goals=""" Bestehende Kunden so zu beraten, dass goals=[
sie von diesen weiterempfohlen werden ('goal', '... Bestehende Kunden so zu beraten, dass sie von diesen weiterempfohlen werden'),
Geeignete Personen wie z.B. Garagisten, Architekten, Treuhänder auf die ('goal', '... Geeignete Personen wie z.B. Garagisten, Architekten, Treuhänder auf die Vermittlung / Zusammenarbeit anzusprechen'),
Vermittlung/Zusammenarbeit anzusprechen ('goal', '... Verschiedene Datenquellen wie Internet, Telefonbuch, Handelszeitung, Baugesuche etc. Gezielt für die Gewinnung von Neukunden zu benützen'),
Verschiedene Datenquellen wie Internet, Telefonbuch, Handelszeitung, Baugesuche etc. Gezielt für die Gewinnung ('goal', '... Ein beliebiges Gespräch resp. Einen bestehenden Kontakt in die Richtung «Versicherung» zu lenken'),
von Neukunden zu benützen ('goal', '... Das Thema Risiko und Sicherheit in einem Gespräch gezielt und auf die Situation des jeweiligen Gesprächspartners bezogen einfliessen zu lassen'),
Ein beliebiges Gespräch resp. Einen bestehenden Kontakt in die Richtung ('goal', '... Im täglichen Kontakt potenzielle Kundinnen und Kunden zu erkennen'),
«Versicherung» zu lenken ],
Das Thema Risiko und Sicherheit in einem Gespräch gezielt und auf die Situation des jeweiligen Gesprächspartners bezogen einfliessen zu lassen )
Im täglichen Kontakt potenzielle Kundinnen und Kunden zu erkennen""")
tp = TopicFactory(title="Beraten der Kunden", parent=lp) tp = TopicFactory(title="Beraten der Kunden", parent=lp)
circle_3 = CircleFactory(title="Einstieg", parent=lp) circle_3 = CircleFactory(title="Einstieg", parent=lp)
circe_analyse = CircleFactory(title="Analyse", parent=lp, circe_analyse = CircleFactory(
description="""Nach dem Gespräch werten sie die Analyse aus und erstellen mit den title="Analyse",
zur Verfügung stehenden Systemen formal korrekte Lösungsvorschläge bzw. parent=lp,
Ausschreibungen. Je nach Komplexität der Situation ziehen sie die nötigen
Fachspezialisten bei.""",
goals="""
Aus dem IST-Zustand (aus der durchgeführten Analyse) individuelle, risikogewichtete und finanzierbare Lösungsvorschläge zu erarbeiten
Eine Unterversicherung, eine Doppeloder Überversicherung oder einen fehlenden Versicherungsschutz festzustellen
Mögliches Optimierungspotential unter Berücksichtigung der finanziellen
Situation des Kunden zu erkennen
Lösungsvorschläge zu skizzieren und
zu visualisieren""")
LearningSequenceFactory(title='Starten', parent=circe_analyse) description="""
LearningUnitFactory( 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'}),
]
)
LearningSequenceFactory(title='Starten', parent=circe_analyse, icon='it-icon-ls-start')
LearningContentFactory(
title='Einleitung Circle "Anlayse"', title='Einleitung Circle "Anlayse"',
parent=circe_analyse, parent=circe_analyse,
minutes=15, minutes=15,
contents=[('video', VideoBlockFactory())] contents=[('video', VideoBlockFactory())]
) )
LearningSequenceFactory(title='Beobachten', parent=circe_analyse, icon='IconLsWatch') LearningSequenceFactory(title='Beobachten', parent=circe_analyse, icon='it-icon-ls-watch')
LearningUnitFactory( LearningUnitFactory(title='Abischerung der Familie', parent=circe_analyse)
LearningContentFactory(
title='Ermittlung des Kundenbedarfs', title='Ermittlung des Kundenbedarfs',
parent=circe_analyse, parent=circe_analyse,
package='Absicherung der Familie',
minutes=30, minutes=30,
contents=[('podcast', PodcastBlockFactory())] contents=[('podcast', PodcastBlockFactory())]
) )
LearningUnitFactory( LearningContentFactory(
title='Kundenbedürfnisse erkennen', title='Kundenbedürfnisse erkennen',
parent=circe_analyse, parent=circe_analyse,
package='Absicherung der Familie',
minutes=30, minutes=30,
contents=[('competence', CompetenceBlockFactory())] contents=[('competence', CompetenceBlockFactory())]
) )
LearningUnitFactory( LearningContentFactory(
title='Was braucht eine Familie?', title='Was braucht eine Familie?',
parent=circe_analyse, parent=circe_analyse,
package='Absicherung der Familie',
minutes=60, minutes=60,
contents=[('exercise', ExerciseBlockFactory())] contents=[('exercise', ExerciseBlockFactory())]
) )
LearningUnitFactory(
title='Selbsteinschätzung',
parent=circe_analyse,
package='Absicherung der Familie',
minutes=0,
contents=[('self_evaluation', SelfEvaluationBlockFactory())]
)
LearningSequenceFactory(title='Anwenden', parent=circe_analyse, icon='IconLsApply') LearningSequenceFactory(title='Anwenden', parent=circe_analyse, icon='it-icon-ls-apply')
LearningUnitFactory( LearningUnitFactory(title='Prämien einsparen', parent=circe_analyse)
LearningContentFactory(
title='Versicherungsbedarf für Familien', title='Versicherungsbedarf für Familien',
parent=circe_analyse, parent=circe_analyse,
package='Prämien einsparen',
minutes=60, minutes=60,
contents=[('exercise', ExerciseBlockFactory())] contents=[('exercise', ExerciseBlockFactory())]
) )
LearningUnitFactory( LearningContentFactory(
title='Alles klar?', title='Alles klar?',
parent=circe_analyse, parent=circe_analyse,
package='Prämien einsparen',
minutes=60, minutes=60,
contents=[('exercise', ExerciseBlockFactory())] contents=[('exercise', ExerciseBlockFactory())]
) )
LearningUnitFactory(
title='Selbsteinschätzung',
parent=circe_analyse,
package='Prämien einsparen',
minutes=0,
contents=[('self_evaluation', SelfEvaluationBlockFactory())]
)
LearningUnitFactory( LearningUnitFactory(title='Sich selbständig machen', parent=circe_analyse)
LearningContentFactory(
title='GmbH oder AG', title='GmbH oder AG',
parent=circe_analyse, parent=circe_analyse,
package='Sich selbständig machen',
minutes=120, minutes=120,
contents=[('video', VideoBlockFactory())] contents=[('video', VideoBlockFactory())]
) )
LearningUnitFactory( LearningContentFactory(
title='Tiertherapie Patrizia Feller', title='Tiertherapie Patrizia Feller',
parent=circe_analyse, parent=circe_analyse,
package='Sich selbständig machen',
minutes=120, minutes=120,
contents=[('exercise', ExerciseBlockFactory())] contents=[('exercise', ExerciseBlockFactory())]
) )
LearningUnitFactory(
title='Selbsteinschätzung',
parent=circe_analyse,
package='Sich selbständig machen',
minutes=0,
contents=[('self_evaluation', SelfEvaluationBlockFactory())]
)
LearningUnitFactory( LearningUnitFactory(title='Auto verkaufen', parent=circe_analyse)
LearningContentFactory(
title='Motorfahrzeugversicherung', title='Motorfahrzeugversicherung',
parent=circe_analyse, parent=circe_analyse,
package='Auto verkaufen',
minutes=240, minutes=240,
contents=[('competence', CompetenceBlockFactory())] contents=[('competence', CompetenceBlockFactory())]
) )
LearningUnitFactory( LearningContentFactory(
title='Nora kauft sich ein neues Auto', title='Nora kauft sich ein neues Auto',
parent=circe_analyse, parent=circe_analyse,
package='Auto verkaufen',
minutes=60, minutes=60,
contents=[('podcast', PodcastBlockFactory())] contents=[('podcast', PodcastBlockFactory())]
) )
LearningUnitFactory( LearningContentFactory(
title='Ermittlung des Kundenbedarfs', title='Ermittlung des Kundenbedarfs',
parent=circe_analyse, parent=circe_analyse,
package='Auto verkaufen',
minutes=120, minutes=120,
contents=[('document', DocumentBlockFactory())] contents=[('document', DocumentBlockFactory())]
) )
LearningUnitFactory( LearningContentFactory(
title='Motorfahrzeug kaufen', title='Motorfahrzeug kaufen',
parent=circe_analyse, parent=circe_analyse,
package='Auto verkaufen',
minutes=120, minutes=120,
contents=[('exercise', ExerciseBlockFactory())] contents=[('exercise', ExerciseBlockFactory())]
) )
LearningUnitFactory(
title='Selbsteinschätzung',
parent=circe_analyse,
package='Auto verkaufen',
minutes=0,
contents=[('self_evaluation', SelfEvaluationBlockFactory())]
)
LearningSequenceFactory(title='Üben', parent=circe_analyse, icon='IconLsPractice') LearningSequenceFactory(title='Üben', parent=circe_analyse, icon='it-icon-ls-practice')
LearningUnitFactory( LearningUnitFactory(title='Kind zieht von zu Hause aus', parent=circe_analyse)
LearningContentFactory(
title='Hausrat', title='Hausrat',
parent=circe_analyse, parent=circe_analyse,
package='Kind zieht von zu Hause aus',
minutes=120, minutes=120,
contents=[('competence', CompetenceBlockFactory())] contents=[('competence', CompetenceBlockFactory())]
) )
LearningUnitFactory( LearningContentFactory(
title='Privathaftpflicht', title='Privathaftpflicht',
parent=circe_analyse, parent=circe_analyse,
package='Kind zieht von zu Hause aus',
minutes=60, minutes=60,
contents=[('competence', CompetenceBlockFactory())] contents=[('competence', CompetenceBlockFactory())]
) )
LearningUnitFactory( LearningContentFactory(
title='Kind zieht von zu Hause aus', title='Kind zieht von zu Hause wirklich aus',
parent=circe_analyse, parent=circe_analyse,
package='Kind zieht von zu Hause aus',
minutes=60, minutes=60,
contents=[('competence', CompetenceBlockFactory())] contents=[('competence', CompetenceBlockFactory())]
) )
LearningUnitFactory(
title='Selbsteinschätzung',
parent=circe_analyse,
package='Kind zieht von zu Hause aus',
minutes=0,
contents=[('self_evaluation', SelfEvaluationBlockFactory())]
)
# learning_unit = LearningUnitFactory.create(title='** Einstieg Video"', parent=circle_4) # learning_unit = LearningUnitFactory.create(title='** Einstieg Video"', parent=circle_4)
# video_url = "https://www.vbv.ch/fileadmin/vbv/Videos/Statements_Externe/Janos_M/Testimonial_Janos_Mischler_PositiveEffekte.mp4" # video_url = "https://www.vbv.ch/fileadmin/vbv/Videos/Statements_Externe/Janos_M/Testimonial_Janos_Mischler_PositiveEffekte.mp4"
@ -285,7 +266,7 @@ von Neukunden zu benützen
def delete_default_learning_path(): def delete_default_learning_path():
LearningUnit.objects.all().delete() LearningContent.objects.all().delete()
LearningSequence.objects.all().delete() LearningSequence.objects.all().delete()
Circle.objects.all().delete() Circle.objects.all().delete()
Topic.objects.all().delete() Topic.objects.all().delete()

View File

@ -1,9 +1,9 @@
import factory import factory
import wagtail_factories import wagtail_factories
from vbv_lernwelt.learnpath.models import LearningPath, Topic, Circle, LearningSequence, LearningUnit from vbv_lernwelt.learnpath.models import LearningPath, Topic, Circle, LearningSequence, LearningContent, LearningUnit
from vbv_lernwelt.learnpath.models_learning_unit_content import VideoBlock, RiseTrainingBlock, PodcastBlock, \ from vbv_lernwelt.learnpath.models_learning_unit_content import VideoBlock, WebBasedTrainingBlock, PodcastBlock, \
CompetenceBlock, ExerciseBlock, SelfEvaluationBlock, DocumentBlock, KnowledgeBlock CompetenceBlock, ExerciseBlock, DocumentBlock, KnowledgeBlock
class LearningPathFactory(wagtail_factories.PageFactory): class LearningPathFactory(wagtail_factories.PageFactory):
@ -36,12 +36,19 @@ class LearningSequenceFactory(wagtail_factories.PageFactory):
class LearningUnitFactory(wagtail_factories.PageFactory): class LearningUnitFactory(wagtail_factories.PageFactory):
title = "Herzlich Willkommen" title = 'Lerneinheit'
class Meta: class Meta:
model = LearningUnit model = LearningUnit
class LearningContentFactory(wagtail_factories.PageFactory):
title = "Herzlich Willkommen"
class Meta:
model = LearningContent
class VideoBlockFactory(wagtail_factories.StructBlockFactory): class VideoBlockFactory(wagtail_factories.StructBlockFactory):
url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ" url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
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" 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"
@ -50,12 +57,12 @@ class VideoBlockFactory(wagtail_factories.StructBlockFactory):
model = VideoBlock model = VideoBlock
class RiseTrainingBlockFactory(wagtail_factories.StructBlockFactory): class WebBasedTrainingBlockFactory(wagtail_factories.StructBlockFactory):
url = "https://www.example.com" url = "https://www.example.com"
description = "Beispiel Rise Modul" description = "Beispiel Rise Modul"
class Meta: class Meta:
model = RiseTrainingBlock model = WebBasedTrainingBlock
class PodcastBlockFactory(wagtail_factories.StructBlockFactory): class PodcastBlockFactory(wagtail_factories.StructBlockFactory):
@ -80,13 +87,6 @@ class ExerciseBlockFactory(wagtail_factories.StructBlockFactory):
model = ExerciseBlock model = ExerciseBlock
class SelfEvaluationBlockFactory(wagtail_factories.StructBlockFactory):
description = "Beispiel Selbsteinschätzung"
class Meta:
model = SelfEvaluationBlock
class DocumentBlockFactory(wagtail_factories.StructBlockFactory): class DocumentBlockFactory(wagtail_factories.StructBlockFactory):
description = "Beispiel Dokument" description = "Beispiel Dokument"

View File

@ -36,7 +36,7 @@ def generate_web_component_icons(request):
'classname': filename.replace('-', '_'), 'classname': filename.replace('-', '_'),
}) })
return render( return render(
request, "learnpath/icons.js", request, "learnpath/icons.html",
context={'svg_files': svg_files}, context={'svg_files': svg_files},
content_type="application/javascript" content_type="application/javascript"
) )