Skip to content

Commit

Permalink
Merge pull request #76 from Felienne/levels-and-steps
Browse files Browse the repository at this point in the history
Remove trajectories, replace with levels/steps
  • Loading branch information
Felienne authored Jun 14, 2020
2 parents b6a3bb8 + 5d77658 commit 64c0a0e
Show file tree
Hide file tree
Showing 14 changed files with 324 additions and 258 deletions.
49 changes: 28 additions & 21 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,24 +134,25 @@ def report_error():
# for now we do not need a post but I am leaving it in for a potential future

# routing to index.html
@app.route('/hedy', methods=['GET'], defaults={ 'level': 1 })
@app.route('/hedy/<level>', methods=['GET'])
def index(level):
@app.route('/hedy', methods=['GET'], defaults={'level': 1, 'step': 1})
@app.route('/hedy/<level>', methods=['GET'], defaults={'step': 1})
@app.route('/hedy/<level>/<step>', methods=['GET'])
def index(level, step):
session_id() # Run this for the side effect of generating a session ID
g.level = level = int(level)
g.lang = lang = requested_lang()
g.prefix = '/hedy'

return hedyweb.render_assignment_editor(
course=HEDY_COURSE[lang],
assignment_number=level,
level_number=level,
assignment_number=step,
menu=render_main_menu('hedy'),
translations=TRANSLATIONS,
version=version())

# routing to docs.html
@app.route('/hedy/<level>/<docspage>', methods=['GET'])
def docs(level, docspage):
@app.route('/hedy/<level>/<step>/<docspage>', methods=['GET'])
def docs(level, step, docspage):
session_id()
g.level = level = int(level)
g.lang = lang = requested_lang()
Expand All @@ -160,39 +161,43 @@ def docs(level, docspage):
return hedyweb.render_assignment_docs(
doc_type=docspage,
course=HEDY_COURSE[lang],
assignment_number=level,
level_number=level,
# We don't have assignments in this course! (yet)
assignment_number=step,
menu=render_main_menu('hedy'),
translations=TRANSLATIONS)


@app.route('/onlinemasters', methods=['GET'], defaults={ 'level': 1 })
@app.route('/onlinemasters/<level>', methods=['GET'])
@app.route('/embed', methods=['GET'], defaults={ 'level': 1 })
@app.route('/embed/<level>', methods=['GET'])
def embed(level):
@app.route('/onlinemasters', methods=['GET'], defaults={'level': 1, 'step': 1})
@app.route('/onlinemasters/<level>', methods=['GET'], defaults={'step': 1})
@app.route('/onlinemasters/<level>/<step>', methods=['GET'])
def onlinemasters(level, step):
session_id() # Run this for the side effect of generating a session ID
g.level = level = int(level)
g.lang = lang = requested_lang()
g.prefix = '/embed'
g.prefix = '/onlinemasters'

return hedyweb.render_assignment_editor(
course=ONLINE_MASTERS_COURSE,
assignment_number=level,
level_number=level,
assignment_number=step,
translations=TRANSLATIONS,
version=version(),
menu=None)

@app.route('/space_eu', methods=['GET'], defaults={ 'level': 1 })
@app.route('/space_eu/<level>', methods=['GET'])
def space_eu(level):
@app.route('/space_eu', methods=['GET'], defaults={'level': 1, 'step': 1})
@app.route('/space_eu/<level>', methods=['GET'], defaults={'step': 1})
@app.route('/space_eu/<level>/<step>', methods=['GET'])
def space_eu(level, step):
session_id() # Run this for the side effect of generating a session ID
g.level = level = int(level)
g.lang = lang = requested_lang()
g.prefix = '/space_eu'

return hedyweb.render_assignment_editor(
course=SPACE_EU_COURSE,
assignment_number=level,
level_number=level,
assignment_number=step,
translations=TRANSLATIONS,
version=version(),
menu=None)
Expand Down Expand Up @@ -263,10 +268,12 @@ def current_language():
return make_lang_obj(requested_lang())

@app.template_global()
def hedy_link(assignment_nr, subpage=None, lang=None):
def hedy_link(level_nr, assignment_nr, subpage=None, lang=None):
"""Make a link to a Hedy page."""
parts = [g.prefix]
parts.append('/' + str(assignment_nr))
parts.append('/' + str(level_nr))
if str(assignment_nr) != '1' or subpage:
parts.append('/' + str(assignment_nr if assignment_nr else '1'))
if subpage and subpage != 'code':
parts.append('/' + subpage)
parts.append('?')
Expand Down
17 changes: 8 additions & 9 deletions coursedata/course/hedy/en.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
---
# This file seems rather empty but the assignments all use the defaults from 'level-defaults'
trajectories:
default:
- level: "1"
- level: "2"
- level: "3"
- level: "4"
- level: "5"
- level: "6"
- level: "7"
course:
- level: "1"
- level: "2"
- level: "3"
- level: "4"
- level: "5"
- level: "6"
- level: "7"

17 changes: 8 additions & 9 deletions coursedata/course/hedy/es.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
---
# This file seems rather empty but the assignments all use the defaults from 'level-defaults'
trajectories:
default:
- level: "1"
- level: "2"
- level: "3"
- level: "4"
- level: "5"
- level: "6"
- level: "7"
course:
- level: "1"
- level: "2"
- level: "3"
- level: "4"
- level: "5"
- level: "6"
- level: "7"
17 changes: 8 additions & 9 deletions coursedata/course/hedy/fr.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
---
# This file seems rather empty but the assignments all use the defaults from 'level-defaults'
trajectories:
default:
- level: "1"
- level: "2"
- level: "3"
- level: "4"
- level: "5"
- level: "6"
- level: "7"
course:
- level: "1"
- level: "2"
- level: "3"
- level: "4"
- level: "5"
- level: "6"
- level: "7"

17 changes: 8 additions & 9 deletions coursedata/course/hedy/nl.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
---
# This file seems rather empty but the assignments all use the defaults from 'level-defaults'
trajectories:
default:
- level: "1"
- level: "2"
- level: "3"
- level: "4"
- level: "5"
- level: "6"
- level: "7"
course:
- level: "1"
- level: "2"
- level: "3"
- level: "4"
- level: "5"
- level: "6"
- level: "7"

54 changes: 33 additions & 21 deletions coursedata/course/online_masters/nl.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
trajectories:
default:
-
level: "1"
course:
-
level: "1"
assignments:
- step: "1"
prompt: |
<a href="https://youtu.be/LKnQvUvCRqM" target="_blank">Klik hier om de uitlegvideo te bekijken.</a>
Expand All @@ -11,8 +12,10 @@
Het eerste begin van Steen, schaar, papier maak je met : `print steen, schaar en papier!`
start_code: |
ask Wil jij een spelletje met me doen?
-
level: "2"
-
level: "2"
assignments:
- step: "1"
prompt: |
<a href="https://youtu.be/bTsUdpK4Co8" target="_blank">Klik hier om de uitlegvideo te bekijken.</a>
Expand All @@ -28,9 +31,10 @@
start_code: |
naam is ask Hoe heet jij?
print Jij heet dus naam
-
level: "3"
prompt: |
-
level: "3"
assignments:
- prompt: |
<a href="https://youtu.be/3XT7nhsXVkY" target="_blank">Klik hier om de uitlegvideo te bekijken.</a>
Probeer eerst de oefeningen hier boven in het linker programmeerveld. Vergeet niet steeds op de knop 'Voer de code' uit te klikken. Maak na het oefenen deze opdrachten.
Expand All @@ -45,14 +49,16 @@
```
Herinnering: `random` (je zegt ren-dom) is het Engelse woord voor willekeurig.
-
level: "4"
-
level: "4"
assignments:
- step: "1"
prompt: |
<a href="https://youtu.be/1HjVN_HEdCc" target="_blank">Klik hier om de uitlegvideo te bekijken.</a>
<a href="https://youtu.be/1HjVN_HEdCc" target="_blank">Klik hier om de uitlegvideo te bekijken.</a>
Probeer eerst de oefeningen hier boven in het linker programmeerveld. Vergeet niet steeds op de knop 'Voer de code' uit te klikken. Maak na het oefenen deze opdrachten.
Probeer eerst de oefeningen hier boven in het linker programmeerveld. Vergeet niet steeds op de knop 'Voer de code' uit te klikken. Maak na het oefenen deze opdrachten.
Probeer nu deze code maar eens:
Probeer nu deze code maar eens:
```
spel is ask Wat is je lievelingsspel?
Expand All @@ -74,8 +80,10 @@
Herinnering: `random` (je zegt ren-dom) is het Engelse woord voor
*willekeurig*; `and` is het Engelse woord voor *en*
-
level: "5"
-
level: "5"
assignments:
- step: "1"
prompt: |
<a href="https://youtu.be/JZuqXNgxTBw" target="_blank">Klik hier om de uitlegvideo te bekijken.</a>
Expand All @@ -91,8 +99,10 @@
Deze code kiest 5 keer, kun jij er nu 10 keer van maken? Of
misschien wel 100 keer!
-
level: "6"
-
level: "6"
assignments:
- step: "1"
prompt: |
<a href="https://youtu.be/mRfpvre2X78" target="_blank">Klik hier om de uitlegvideo te bekijken.</a>
Expand All @@ -119,8 +129,10 @@
if computerkeuze is jouwkeuze print 'gelijkspel'
aantalkeer is aantalkeer + 1
```
- level: "7"
prompt:
- level: "7"
assignments:
- step: 1"
prompt: |
Probeer eerst de oefeningen hier boven in het linker programmeerveld. Vergeet niet steeds op de knop 'Voer de code' uit te klikken. Maak na het oefenen deze opdrachten.
Expand All @@ -135,4 +147,4 @@
repeat 5 times
print 'Poging ' aantalkeer
aantalkeer is aantalkeer+1
aantalkeer is aantalkeer+1
Loading

0 comments on commit 64c0a0e

Please sign in to comment.