Add linking to `evaluate_url` for learning unit
This commit is contained in:
parent
ebfeec4184
commit
3c386f31ca
|
|
@ -37,7 +37,7 @@ const props = withDefaults(defineProps<Props>(), {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<span class="whitespace-nowrap">
|
<span class="whitespace-nowrap">
|
||||||
<a class="link" :href="criteria.learning_unit.frontend_url">
|
<a class="link" :href="criteria.learning_unit.evaluate_url">
|
||||||
Sich nochmals einschätzen
|
Sich nochmals einschätzen
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ export const useCircleStore = defineStore({
|
||||||
},
|
},
|
||||||
openSelfEvaluation(learningUnit: LearningUnit) {
|
openSelfEvaluation(learningUnit: LearningUnit) {
|
||||||
this.router.push({
|
this.router.push({
|
||||||
path: learningUnit.frontend_url,
|
path: learningUnit.evaluate_url,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
closeSelfEvaluation(learningUnit: LearningUnit) {
|
closeSelfEvaluation(learningUnit: LearningUnit) {
|
||||||
|
|
|
||||||
|
|
@ -155,6 +155,7 @@ export interface LearningUnitPerformanceCriteria extends CourseWagtailPage {
|
||||||
export interface LearningUnit extends CourseWagtailPage {
|
export interface LearningUnit extends CourseWagtailPage {
|
||||||
type: "learnpath.LearningUnit";
|
type: "learnpath.LearningUnit";
|
||||||
learningContents: LearningContent[];
|
learningContents: LearningContent[];
|
||||||
|
evaluate_url: string;
|
||||||
minutes: number;
|
minutes: number;
|
||||||
parentLearningSequence?: LearningSequence;
|
parentLearningSequence?: LearningSequence;
|
||||||
parentCircle?: Circle;
|
parentCircle?: Circle;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ from rest_framework import serializers
|
||||||
|
|
||||||
from vbv_lernwelt.competence.models import PerformanceCriteria
|
from vbv_lernwelt.competence.models import PerformanceCriteria
|
||||||
from vbv_lernwelt.course.serializers import CourseCategorySerializer
|
from vbv_lernwelt.course.serializers import CourseCategorySerializer
|
||||||
from vbv_lernwelt.learnpath.models import LearningUnit
|
|
||||||
from vbv_lernwelt.learnpath.serializer_helpers import get_it_serializer_class
|
from vbv_lernwelt.learnpath.serializer_helpers import get_it_serializer_class
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -27,17 +26,11 @@ class PerformanceCriteriaSerializer(
|
||||||
course_category = serializers.SerializerMethodField()
|
course_category = serializers.SerializerMethodField()
|
||||||
|
|
||||||
def get_learning_unit(self, obj):
|
def get_learning_unit(self, obj):
|
||||||
learning_unit_serializer = get_it_serializer_class(
|
from vbv_lernwelt.learnpath.serializers import (
|
||||||
LearningUnit,
|
LearningUnitPerformanceCriteriaSerializer,
|
||||||
[
|
|
||||||
"id",
|
|
||||||
"title",
|
|
||||||
"slug",
|
|
||||||
"type",
|
|
||||||
"translation_key",
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
return learning_unit_serializer(obj.learning_unit).data
|
|
||||||
|
return LearningUnitPerformanceCriteriaSerializer(obj.learning_unit).data
|
||||||
|
|
||||||
def get_circle(self, obj):
|
def get_circle(self, obj):
|
||||||
return obj.learning_unit.get_parent().specific.title
|
return obj.learning_unit.get_parent().specific.title
|
||||||
|
|
|
||||||
|
|
@ -250,6 +250,10 @@ class LearningUnit(Page):
|
||||||
super(LearningUnit, self).full_clean(*args, **kwargs)
|
super(LearningUnit, self).full_clean(*args, **kwargs)
|
||||||
|
|
||||||
def get_frontend_url(self):
|
def get_frontend_url(self):
|
||||||
|
short_slug = self.slug.replace(f"{self.get_parent().slug}-lu-", "")
|
||||||
|
return f"{self.get_parent().specific.get_frontend_url()}#lu-{short_slug}"
|
||||||
|
|
||||||
|
def get_evaluate_url(self):
|
||||||
short_slug = self.slug.replace(f"{self.get_parent().slug}-lu-", "")
|
short_slug = self.slug.replace(f"{self.get_parent().slug}-lu-", "")
|
||||||
return f"{self.get_parent().specific.get_frontend_url()}/evaluate/{short_slug}"
|
return f"{self.get_parent().specific.get_frontend_url()}/evaluate/{short_slug}"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
from rest_framework.fields import SerializerMethodField
|
||||||
|
|
||||||
from vbv_lernwelt.competence.serializers import (
|
from vbv_lernwelt.competence.serializers import (
|
||||||
PerformanceCriteriaLearningPathSerializer,
|
PerformanceCriteriaLearningPathSerializer,
|
||||||
)
|
)
|
||||||
|
|
@ -9,13 +11,34 @@ class LearningUnitSerializer(
|
||||||
get_it_serializer_class(
|
get_it_serializer_class(
|
||||||
LearningUnit,
|
LearningUnit,
|
||||||
[
|
[
|
||||||
|
"evaluate_url",
|
||||||
"course_category",
|
"course_category",
|
||||||
"children",
|
"children",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
):
|
):
|
||||||
|
evaluate_url = SerializerMethodField()
|
||||||
|
|
||||||
def get_children(self, obj):
|
def get_children(self, obj):
|
||||||
return [
|
return [
|
||||||
PerformanceCriteriaLearningPathSerializer(child).data
|
PerformanceCriteriaLearningPathSerializer(child).data
|
||||||
for child in obj.performancecriteria_set.all()
|
for child in obj.performancecriteria_set.all()
|
||||||
]
|
]
|
||||||
|
|
||||||
|
def get_evaluate_url(self, obj):
|
||||||
|
return obj.get_evaluate_url()
|
||||||
|
|
||||||
|
|
||||||
|
class LearningUnitPerformanceCriteriaSerializer(
|
||||||
|
get_it_serializer_class(
|
||||||
|
LearningUnit,
|
||||||
|
[
|
||||||
|
"evaluate_url",
|
||||||
|
"course_category",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
):
|
||||||
|
evaluate_url = SerializerMethodField()
|
||||||
|
|
||||||
|
def get_evaluate_url(self, obj):
|
||||||
|
return obj.get_evaluate_url()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue