Commit c8e2e8e63f81b3e4413cf3ad7e571f29d33e7d3d

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

- show solution in review for unanswered questions.

- fixes and improvements in the demo.
demo/questions/questions-tutorial.yaml
... ... @@ -11,17 +11,26 @@
11 11  
12 12 ```yaml
13 13 #-----------------------------------------------------------------------------
  14 + # ref: Referência atribuida a um teste. A mesma referência pode ser usada em vários turnos
  15 + # title: Título do teste, por exemplo "Unidade Curricular - Exame de recurso"
  16 + # database: Base de dados previamente inicializada com os alunos inscritos usando o comando initdb.py
  17 + # answers: Directório onde vão ficar guardados os testes dos alunos com as respostas e respectivas correcções.
14 18 ref: tutorial
15 19 title: Teste de Avaliação
16 20 database: demo/students.db
17 21 answers_dir: demo/ans
18 22  
19   - # (opcional) minutos
20   - duration: 90
  23 + # Duração do teste, apenas informativo para o aluno
  24 + # (opcional, default: infinito) minutos
  25 + duration: 60
21 26  
22 27 # (opcional, default: False) mostra cotação das perguntas aos alunos, escala 0-20.
23 28 show_points: True
24 29  
  30 + # untested. Points are scaled so that total of exam is given by scale_max
  31 + scale_points: True
  32 + scale_max: 20
  33 +
25 34 # (opcional, default: False)
26 35 debug: False
27 36  
... ... @@ -29,7 +38,7 @@
29 38 # Directório base onde estão as perguntas
30 39 questions_dir: ~/topics/P1
31 40  
32   - # Ficheiros de perguntas a importar
  41 + # Ficheiros de perguntas a importar (relativamente a ~/topics/P1)
33 42 files:
34 43 - topico_A/parte_1/questions.yaml
35 44 - topico_A/parte_2/questions.yaml
... ... @@ -39,16 +48,16 @@
39 48 # Perguntas do teste e respectivas cotações
40 49 questions:
41 50 - ref: pergunta1
42   - grade: 3.5
  51 + points: 3.5
43 52  
44 53 - ref: pergunta2
45   - grade: 2
  54 + points: 2
46 55  
47 56 - ref: tabela-auxiliar
48   -
  57 +
49 58 # escolhe uma das seguintes aleatoriamente
50 59 - ref: [ pergunta3a, pergunta3b ]
51   - grade: 0.5
  60 + points: 0.5
52 61  
53 62 # a cotação é 1.0 por defeito, caso não esteja definida
54 63 - ref: pergunta4
... ... @@ -109,7 +118,7 @@
109 118 options:
110 119 - Opção 0
111 120 - Opção 1
112   - - Opção 2
  121 + - Opção 2
113 122 - Opção 3
114 123 - Opção 4
115 124 ```
... ... @@ -139,7 +148,8 @@
139 148 correct: [1, 1, 0, 0, 0]
140 149 choose: 3
141 150 shuffle: True
142   -
  151 + solution: |
  152 + A solução correcta é a **opção 0**.
143 153  
144 154 # ----------------------------------------------------------------------------
145 155 - type: checkbox
... ... @@ -156,10 +166,10 @@
156 166 title: Escolha múltipla, várias opções correctas
157 167 text: |
158 168 Bla bla bla.
159   - options:
  169 + options:
160 170 - Opção 0
161 171 - Opção 1
162   - - Opção 2
  172 + - Opção 2
163 173 - Opção 3
164 174 - Opção 4
165 175 correct: [1, -1, -1, 1, -1]
... ... @@ -194,14 +204,14 @@
194 204  
195 205 # ----------------------------------------------------------------------------
196 206 - type: text
197   - ref: tut-text
  207 + ref: tut-text
198 208 title: Resposta de texto em linha
199 209 text: |
200 210 Este tipo de perguntas permite uma resposta numa linha de texto. A resposta está correcta se coincidir com alguma das respostas admissíveis.
201 211  
202 212 ```yaml
203 213 - type: text
204   - ref: tut-text
  214 + ref: tut-text
205 215 title: Resposta de texto em linha
206 216 text: |
207 217 Bla bla bla
... ... @@ -234,7 +244,7 @@
234 244  
235 245 # ---------------------------------------------------------------------------
236 246 - type: numeric-interval
237   - ref: tut-numeric-interval
  247 + ref: tut-numeric-interval
238 248 title: Resposta numérica em linha de texto
239 249 text: |
240 250 Este tipo de perguntas esperam uma resposta numérica (vírgula flutuante).
... ... @@ -242,20 +252,22 @@
242 252  
243 253 ```yaml
244 254 - type: numeric-interval
245   - ref: tut-numeric-interval
  255 + ref: tut-numeric-interval
246 256 title: Resposta numérica em linha de texto
247 257 text: |
248 258 Bla bla bla
249   - correct: [3.14, 3.15]
  259 + correct: [3.14, 3.15]
250 260 ```
251 261  
252 262 Neste exemplo o intervalo de respostas correctas é [3.14, 3.15].
253 263 correct: [3.14, 3.15]
  264 + solution: |
  265 + Um exemplo de uma resposta correcta é o número $\pi\approx 3.14159265359$.
254 266  
255 267  
256 268 # ---------------------------------------------------------------------------
257 269 - type: textarea
258   - ref: tut-textarea
  270 + ref: tut-textarea
259 271 title: Resposta em múltiplas linhas de texto
260 272 text: |
261 273 Este tipo de perguntas permitem respostas em múltiplas linhas de texto, que podem ser úteis por exemplo para validar código.
... ... @@ -264,7 +276,7 @@
264 276  
265 277 ```yaml
266 278 - type: textarea
267   - ref: tut-textarea
  279 + ref: tut-textarea
268 280 title: Resposta em múltiplas linhas de texto
269 281 text: |
270 282 Bla bla bla
... ... @@ -335,7 +347,7 @@
335 347 return 0; // comentario
336 348 }
337 349 ```
338   -
  350 +
339 351 Faz-se assim:
340 352  
341 353 - type: success
... ... @@ -345,18 +357,18 @@
345 357 Também não conta para avaliação.
346 358  
347 359 Já vimos como se introduzem fórmulas LaTeX, também se pode escrever troços de código:
348   -
  360 +
349 361 ```C
350 362 int main() {
351 363 printf("Hello world!");
352 364 return 0; // comentario
353 365 }
354 366 ```
355   -
  367 +
356 368  
357 369 # ---------------------------------------------------------------------------
358 370 - type: warning
359   - ref: tut-warning
  371 + ref: tut-warning
360 372 title: Texto informativo (aviso)
361 373 text: |
362 374 Não conta para avaliação.
... ... @@ -373,7 +385,7 @@
373 385  
374 386 ```yaml
375 387 - type: warning
376   - ref: tut-warning
  388 + ref: tut-warning
377 389 title: Texto informativo (aviso)
378 390 text: |
379 391 Bla bla bla
... ... @@ -390,7 +402,7 @@
390 402  
391 403 # ----------------------------------------------------------------------------
392 404 - type: alert
393   - ref: tut-alert
  405 + ref: tut-alert
394 406 title: Texto informativo (perigo)
395 407 text: |
396 408 Texto importante. Não conta para avaliação.
... ...
demo/test-tutorial.yaml
... ... @@ -37,24 +37,25 @@ questions_dir: demo
37 37 # Selected questions will be obtained from these files.
38 38 # If undefined, all yaml files in questions_dir are loaded (not recommended).
39 39 files:
40   - - questions/questions-tutorial.yaml
  40 + - questions/questions-tutorial.yaml
41 41  
42 42 # This is the list of questions that will make up the test.
43 43 # The order is preserved.
44 44 # There are several ways to define each question (explained below).
45 45 questions:
46   - - tut-test
47   - - tut-questions
48   -
49   - - tut-radio
50   - - tut-checkbox
51   - - tut-text
52   - - tut-text-regex
53   - - tut-numeric-interval
54   - - tut-textarea
55   -
56   - - tut-information
57   - - tut-success
58   - - tut-warning
59   - - tut-alert
60   -
  46 + - tut-test
  47 + - tut-questions
  48 +
  49 + - tut-radio
  50 + - tut-checkbox
  51 + - tut-text
  52 + - tut-text-regex
  53 + - tut-numeric-interval
  54 + - ref: tut-textarea
  55 + points: 2.0
  56 +
  57 + - tut-information
  58 + - tut-success
  59 + - tut-warning
  60 + - tut-alert
  61 +
... ...
templates/review-question.html
... ... @@ -41,8 +41,8 @@
41 41 pontos<br>
42 42 {{ q['comments'] }}
43 43 {% if 'solution' in q %}
44   - <hr>
45   - {{ md('**Solução:** ' + q['solution']) }}
  44 + <hr>
  45 + {{ md('**Solução:** ' + q['solution']) }}
46 46 {% end %}
47 47 </p>
48 48 {% else %}
... ... @@ -52,8 +52,8 @@
52 52 pontos<br>
53 53 {{ q['comments'] }}
54 54 {% if 'solution' in q %}
55   - <hr>
56   - {{ md('**Solução:** ' + q['solution']) }}
  55 + <hr>
  56 + {{ md('**Solução:** ' + q['solution']) }}
57 57 {% end %}
58 58 </p>
59 59 {% end %}
... ... @@ -94,6 +94,10 @@
94 94 <i class="fas fa-ban fa-3x" aria-hidden="true"></i>
95 95 {{ round(q['grade'] * q['points'], 2) }} pontos<br>
96 96 {{ q['comments'] }}
  97 + {% if 'solution' in q %}
  98 + <hr>
  99 + {{ md('**Solução:** ' + q['solution']) }}
  100 + {% end %}
97 101 </p>
98 102  
99 103 {% if t['show_ref'] %}
... ...