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