diff --git a/client/src/components/circle/SimpleCircleDiagram.vue b/client/src/components/circle/SimpleCircleDiagram.vue
index e6b976ca..bdfb7f9a 100644
--- a/client/src/components/circle/SimpleCircleDiagram.vue
+++ b/client/src/components/circle/SimpleCircleDiagram.vue
@@ -3,7 +3,7 @@ import * as d3 from 'd3';
export default {
props: {
- learningSequeces: {required: false,
+ learningSequences: {required: false,
default: [{title: '', done: false}, {title: '', done: false}, {title: '', done: false}, {title: '', done: false}]},
width: {
default: 250,
@@ -16,7 +16,7 @@ export default {
},
computed: {
pieData () {
- return new Array(this.learningSequeces.length).fill(1);
+ return new Array(Math.max(this.learningSequences.length, 1)).fill(1);
},
viewBox() {
return `0 0 ${this.width} ${this.height}`;
diff --git a/client/src/views/LearningPathView.vue b/client/src/views/LearningPathView.vue
index 6031cc7a..d34f711a 100644
--- a/client/src/views/LearningPathView.vue
+++ b/client/src/views/LearningPathView.vue
@@ -75,7 +75,7 @@ export default {
diff --git a/server/vbv_lernwelt/learnpath/models.py b/server/vbv_lernwelt/learnpath/models.py
index 51efc479..862a901f 100644
--- a/server/vbv_lernwelt/learnpath/models.py
+++ b/server/vbv_lernwelt/learnpath/models.py
@@ -28,12 +28,11 @@ class LearningPath(Page):
class Topic(Page):
- # title = models.TextField(default='')
+ # title = models.TextField(default='')
is_visible = models.BooleanField(default=True)
parent_page_types = ['learnpath.LearningPath']
-
panels = [FieldPanel('title'),
FieldPanel('is_visible'),
]
@@ -43,7 +42,6 @@ class Topic(Page):
APIField('is_visible'),
]
-
# content_panels = Page.content_panels + [
# FieldPanel('is_visible', classname="full"),
# PageChooserPanel('learning_path', 'learnpath.LearningPath'),
@@ -57,14 +55,13 @@ class Topic(Page):
print(self.slug)
super(Topic, self).full_clean(*args, **kwargs)
-
@classmethod
def get_serializer_class(cls):
- return get_it_serializer_class(cls, field_names=['id', 'title', 'slug', 'type', 'translation_key', 'is_visible'])
-
+ return get_it_serializer_class(cls,
+ field_names=['id', 'title', 'slug', 'type', 'translation_key', 'is_visible', ])
class Meta:
- verbose_name = "Topic"
+ verbose_name = "Topic"
def __str__(self):
return f"{self.title}"
@@ -74,14 +71,6 @@ class Circle(Page):
description = models.TextField(default="", blank=True)
goals = models.TextField(default="", blank=True)
- # topic = models.ForeignKey(
- # 'learnpath.Topic',
- # null=True,
- # blank=True,
- # on_delete=models.SET_NULL,
- # related_name='circles'
- # )
-
parent_page_types = ['learnpath.LearningPath']
subpage_types = ['learnpath.LearningSequence', 'learnpath.LearningUnit']
@@ -93,12 +82,16 @@ class Circle(Page):
api_fields = [
APIField('title'),
APIField('description'),
+ APIField('learning_sequences'),
]
+ @property
+ def learning_sequences(self):
+ return self.get_children().filter(content_type__model='learningsequence').values('id', 'title')
@classmethod
def get_serializer_class(cls):
- return get_it_serializer_class(cls, field_names=['id', 'title', 'slug', 'type', 'translation_key'])
+ return get_it_serializer_class(cls, field_names=['id', 'title', 'slug', 'type', 'translation_key', 'learning_sequences'])
def full_clean(self, *args, **kwargs):
self.slug = find_available_slug(Circle, slugify(self.title, allow_unicode=True))
@@ -192,7 +185,9 @@ class LearningUnit(Page):
@classmethod
def get_serializer_class(cls):
- return get_it_serializer_class(cls, field_names=['id', 'title', 'minutes', 'package', 'contents', 'slug', 'type', 'translation_key'])
+ return get_it_serializer_class(cls,
+ field_names=['id', 'title', 'minutes', 'package', 'contents', 'slug', 'type',
+ 'translation_key'])
def __str__(self):
return f"{self.title}"
diff --git a/server/vbv_lernwelt/learnpath/tests/test_create_default_competences.py b/server/vbv_lernwelt/learnpath/tests/test_create_default_competences.py
index 64cdd3c5..d1b63399 100644
--- a/server/vbv_lernwelt/learnpath/tests/test_create_default_competences.py
+++ b/server/vbv_lernwelt/learnpath/tests/test_create_default_competences.py
@@ -7,3 +7,6 @@ class TestCreateDefaultCompetences(TestCase):
def test_create_default_competeneces(self):
create_default_competences()
+
+
+
diff --git a/server/vbv_lernwelt/learnpath/tests/test_create_default_learning_path.py b/server/vbv_lernwelt/learnpath/tests/test_create_default_learning_path.py
index bbe0be8f..c1dd510c 100644
--- a/server/vbv_lernwelt/learnpath/tests/test_create_default_learning_path.py
+++ b/server/vbv_lernwelt/learnpath/tests/test_create_default_learning_path.py
@@ -2,12 +2,14 @@ from django.conf import settings
from django.test import TestCase
from wagtail.core.models import Locale
+from vbv_lernwelt.core.create_default_users import create_default_users
from vbv_lernwelt.learnpath.models import LearningPath
from vbv_lernwelt.learnpath.tests.create_default_learning_path import create_default_learning_path
class TestCreateDefaultLearningPaths(TestCase):
def setUp(self) -> None:
+ create_default_users()
create_locales_for_wagtail()
def test_create_learning_path(self):