Generate additional simple learningPath for development
This commit is contained in:
parent
eaa06719d6
commit
26139304a3
|
|
@ -1,106 +0,0 @@
|
|||
<script>
|
||||
import * as d3 from 'd3';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
learningSequences: {
|
||||
required: false,
|
||||
default: [{title: '', done: false}, {title: '', done: false}, {title: '', done: false}, {title: '', done: false}]
|
||||
},
|
||||
width: {
|
||||
default: 250,
|
||||
type: Number,
|
||||
},
|
||||
height: {
|
||||
default: 250,
|
||||
type: Number,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
pieData() {
|
||||
return new Array(Math.max(this.learningSequences.length, 1)).fill(1)
|
||||
},
|
||||
viewBox() {
|
||||
return `0 0 ${this.width} ${this.height}`
|
||||
},
|
||||
},
|
||||
|
||||
mounted() {
|
||||
console.log(this.pieData)
|
||||
const data = this.pieData
|
||||
|
||||
const width = this.width
|
||||
const height = this.height
|
||||
const radius = Math.min(width, height) / 2.5
|
||||
console.log(this.viewBox)
|
||||
|
||||
|
||||
const svg = d3.select(this.$el)
|
||||
.append('svg')
|
||||
.attr('width', width)
|
||||
.attr('height', height)
|
||||
|
||||
|
||||
const g = svg.append('g').attr('transform', 'translate(' + width / 2 + ',' + height / 2 + ')')
|
||||
|
||||
|
||||
// Generate the pie
|
||||
const pie = d3.pie()
|
||||
|
||||
// Generate the arcs
|
||||
const arc = d3
|
||||
.arc()
|
||||
.innerRadius(radius / 2)
|
||||
.padAngle(12 / 360)
|
||||
.outerRadius(radius)
|
||||
|
||||
|
||||
//Generate groups
|
||||
const arcs = g.selectAll('arc')
|
||||
.data(pie(data))
|
||||
.enter()
|
||||
.append('g')
|
||||
.attr('class', 'arc')
|
||||
|
||||
|
||||
//Draw arc paths
|
||||
arcs.append('path')
|
||||
.attr('d', arc)
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.svg-container {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
padding-bottom: 100%;
|
||||
vertical-align: top;
|
||||
overflow: hidden;
|
||||
fill: rgb(65 181 250);
|
||||
|
||||
}
|
||||
|
||||
.svg-content {
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
fill: rgb(65 181 250);
|
||||
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
<template>
|
||||
<div id="container" class="svg-container">
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -1,9 +1,10 @@
|
|||
import djclick as click
|
||||
|
||||
from vbv_lernwelt.learnpath.create_default_learning_path import create_default_learning_path
|
||||
from vbv_lernwelt.learnpath.tests.create_simple_test_learning_path import create_simple_test_learning_path
|
||||
|
||||
|
||||
@click.command()
|
||||
def command():
|
||||
create_default_learning_path(skip_locales=True)
|
||||
# create_simple_test_learning_path(skip_locales=True)
|
||||
create_simple_test_learning_path(skip_locales=True)
|
||||
|
|
|
|||
|
|
@ -125,7 +125,39 @@ def create_simple_test_learning_path(user=None, skip_locales=True):
|
|||
site.save()
|
||||
|
||||
lp = LearningPathFactory(title="Unit-Test Lernpfad", parent=site.root_page)
|
||||
TopicFactory(title="Unit-Test Topic", is_visible=False, parent=lp)
|
||||
|
||||
TopicFactory(title="Basis", is_visible=False, parent=lp)
|
||||
|
||||
circle_basis = CircleFactory(
|
||||
title="Basis",
|
||||
parent=lp,
|
||||
description="Basis von Unit-Test Lernpfad",
|
||||
)
|
||||
LearningSequenceFactory(title='Starten', parent=circle_basis, icon='it-icon-ls-start')
|
||||
LearningContentFactory(
|
||||
title='Einleitung Circle "Basis"',
|
||||
parent=circle_basis,
|
||||
minutes=15,
|
||||
contents=[('video', VideoBlockFactory(
|
||||
url='https://www.youtube.com/embed/qhPIfxS2hvI',
|
||||
description='Basis Video'
|
||||
))]
|
||||
)
|
||||
LearningSequenceFactory(title='Beenden', parent=circle_basis, icon='it-icon-ls-end')
|
||||
LearningContentFactory(
|
||||
title='Kompetenzprofil anschauen',
|
||||
parent=circle_basis,
|
||||
minutes=30,
|
||||
contents=[('document', CompetenceBlockFactory())]
|
||||
)
|
||||
LearningContentFactory(
|
||||
title='Circle "Analyse" abschliessen',
|
||||
parent=circle_basis,
|
||||
minutes=30,
|
||||
contents=[('document', CompetenceBlockFactory())]
|
||||
)
|
||||
|
||||
TopicFactory(title="Gewinnen von Kunden", parent=lp)
|
||||
|
||||
circle_analyse = create_circle('Unit-Test Circle', lp)
|
||||
create_circle_children(circle_analyse, 'Unit-Test Circle')
|
||||
|
|
|
|||
|
|
@ -26,6 +26,6 @@ class TestRetrieveLearingPathContents(APITestCase):
|
|||
|
||||
self.assertEqual(learning_path.title, data['title'])
|
||||
# topic and circle
|
||||
self.assertEqual(2, len(data['children']))
|
||||
self.assertEqual(4, len(data['children']))
|
||||
# circle "unit-test-circle" contents
|
||||
self.assertEqual(13, len(data['children'][1]['children']))
|
||||
self.assertEqual(13, len(data['children'][3]['children']))
|
||||
|
|
|
|||
Loading…
Reference in New Issue