Commit e875d402b6eabbcc662462a85de6968a719e4d83

Authored by Miguel Barão
1 parent d8144588
Exists in master and in 1 other branch dev

- if question has no ref, a default is generated in the form "topic_name:0".

BUGS.md
... ... @@ -3,7 +3,6 @@
3 3  
4 4 - on start topic, logs show questionhandler.get() twice.
5 5 - change password modal nao aparece no ipad (safari e firefox)
6   -- detect questions in questions.yaml without ref -> error ou generate default.
7 6 - tabelas nas perguntas radio/checkbox não ocupam todo o espaço como em question.
8 7  
9 8 # TODO
... ... @@ -27,6 +26,7 @@
27 26  
28 27 # FIXED
29 28  
  29 +- detect questions in questions.yaml without ref -> error ou generate default.
30 30 - generators e correct scripts que durem muito tempo bloqueiam o eventloop do tornado.
31 31 - servir imagens/ficheiros.
32 32 - radio: suporte para multiplas opcoes correctas e erradas, escolhendo-se uma selecção aleatoria destas (so com 1 certa).
... ...
demo/solar_system/questions.yaml
1 1 ---
2 2  
3 3 # ---------------------------------------------------------------------------
4   --
5   - ref: solar-system
6   - type: radio
7   - title: Sistema solar
8   - text: |
9   - ![planetas](planets.png " Planetas do Sistema Solar")
  4 +- ref: solar-system
  5 + type: radio
  6 + title: Sistema solar
  7 + text: |
  8 + ![planetas](planets.png " Planetas do Sistema Solar")
10 9  
11   - Qual é o maior planeta do Sistema Solar?
12   - options:
13   - - Mercúrio
14   - - Marte
15   - - Júpiter
16   - - Têm todos o mesmo tamanho
17   - # opcional
18   - correct: 2
19   - shuffle: False
20   - discount: True
  10 + Qual é o maior planeta do Sistema Solar?
  11 +
  12 + options:
  13 + - Mercúrio
  14 + - Marte
  15 + - Júpiter
  16 + - Têm todos o mesmo tamanho
  17 + # opcional
  18 + correct: 2
  19 + shuffle: False
  20 + discount: True
21 21  
22 22 # # ---------------------------------------------------------------------------
23 23 # -
... ... @@ -38,14 +38,13 @@
38 38 # correct: !regex '[Ss]aturno'
39 39  
40 40 # ---------------------------------------------------------------------------
41   --
42   - ref: first_3_planets
43   - type: textarea
44   - title: Sistema solar
45   - text: Escreva o nome dos três planetas mais próximos do Sol. (Exemplo `A, B e C`)
46   - # correct: correct-first_3_planets.py
47   - correct: correct-timeout.py
48   - # opcional
49   - answer: Vulcano, Krypton, Plutão
50   - lines: 3
51   - timeout: 50
  41 +- ref: first_3_planets
  42 + type: textarea
  43 + title: Sistema solar
  44 + text: Escreva o nome dos três planetas mais próximos do Sol. (Exemplo `A, B e C`)
  45 + # correct: correct-first_3_planets.py
  46 + correct: correct-timeout.py
  47 + # opcional
  48 + answer: Vulcano, Krypton, Plutão
  49 + lines: 3
  50 + timeout: 50
... ...
learnapp.py
... ... @@ -303,7 +303,7 @@ def build_dependency_graph(config={}):
303 303  
304 304 # if questions not in configuration then load all, preserving order
305 305 if not tnode['questions']:
306   - tnode['questions'] = [q['ref'] for q in loaded_questions]
  306 + tnode['questions'] = [q.setdefault('ref', f'{ref}:{i}') for i,q in enumerate(loaded_questions)]
307 307  
308 308 # make questions factory (without repeating same question)
309 309 tnode['factory'] = {}
... ...