From c8e2e8e63f81b3e4413cf3ad7e571f29d33e7d3d Mon Sep 17 00:00:00 2001 From: Miguel Barão Date: Sat, 12 Jan 2019 13:47:01 +0000 Subject: [PATCH] - show solution in review for unanswered questions. - fixes and improvements in the demo. --- demo/questions/questions-tutorial.yaml | 60 ++++++++++++++++++++++++++++++++++++------------------------ demo/test-tutorial.yaml | 33 +++++++++++++++++---------------- templates/review-question.html | 12 ++++++++---- 3 files changed, 61 insertions(+), 44 deletions(-) diff --git a/demo/questions/questions-tutorial.yaml b/demo/questions/questions-tutorial.yaml index 9289ae1..f6fbb62 100644 --- a/demo/questions/questions-tutorial.yaml +++ b/demo/questions/questions-tutorial.yaml @@ -11,17 +11,26 @@ ```yaml #----------------------------------------------------------------------------- + # ref: Referência atribuida a um teste. A mesma referência pode ser usada em vários turnos + # title: Título do teste, por exemplo "Unidade Curricular - Exame de recurso" + # database: Base de dados previamente inicializada com os alunos inscritos usando o comando initdb.py + # answers: Directório onde vão ficar guardados os testes dos alunos com as respostas e respectivas correcções. ref: tutorial title: Teste de Avaliação database: demo/students.db answers_dir: demo/ans - # (opcional) minutos - duration: 90 + # Duração do teste, apenas informativo para o aluno + # (opcional, default: infinito) minutos + duration: 60 # (opcional, default: False) mostra cotação das perguntas aos alunos, escala 0-20. show_points: True + # untested. Points are scaled so that total of exam is given by scale_max + scale_points: True + scale_max: 20 + # (opcional, default: False) debug: False @@ -29,7 +38,7 @@ # Directório base onde estão as perguntas questions_dir: ~/topics/P1 - # Ficheiros de perguntas a importar + # Ficheiros de perguntas a importar (relativamente a ~/topics/P1) files: - topico_A/parte_1/questions.yaml - topico_A/parte_2/questions.yaml @@ -39,16 +48,16 @@ # Perguntas do teste e respectivas cotações questions: - ref: pergunta1 - grade: 3.5 + points: 3.5 - ref: pergunta2 - grade: 2 + points: 2 - ref: tabela-auxiliar - + # escolhe uma das seguintes aleatoriamente - ref: [ pergunta3a, pergunta3b ] - grade: 0.5 + points: 0.5 # a cotação é 1.0 por defeito, caso não esteja definida - ref: pergunta4 @@ -109,7 +118,7 @@ options: - Opção 0 - Opção 1 - - Opção 2 + - Opção 2 - Opção 3 - Opção 4 ``` @@ -139,7 +148,8 @@ correct: [1, 1, 0, 0, 0] choose: 3 shuffle: True - + solution: | + A solução correcta é a **opção 0**. # ---------------------------------------------------------------------------- - type: checkbox @@ -156,10 +166,10 @@ title: Escolha múltipla, várias opções correctas text: | Bla bla bla. - options: + options: - Opção 0 - Opção 1 - - Opção 2 + - Opção 2 - Opção 3 - Opção 4 correct: [1, -1, -1, 1, -1] @@ -194,14 +204,14 @@ # ---------------------------------------------------------------------------- - type: text - ref: tut-text + ref: tut-text title: Resposta de texto em linha text: | Este tipo de perguntas permite uma resposta numa linha de texto. A resposta está correcta se coincidir com alguma das respostas admissíveis. ```yaml - type: text - ref: tut-text + ref: tut-text title: Resposta de texto em linha text: | Bla bla bla @@ -234,7 +244,7 @@ # --------------------------------------------------------------------------- - type: numeric-interval - ref: tut-numeric-interval + ref: tut-numeric-interval title: Resposta numérica em linha de texto text: | Este tipo de perguntas esperam uma resposta numérica (vírgula flutuante). @@ -242,20 +252,22 @@ ```yaml - type: numeric-interval - ref: tut-numeric-interval + ref: tut-numeric-interval title: Resposta numérica em linha de texto text: | Bla bla bla - correct: [3.14, 3.15] + correct: [3.14, 3.15] ``` Neste exemplo o intervalo de respostas correctas é [3.14, 3.15]. correct: [3.14, 3.15] + solution: | + Um exemplo de uma resposta correcta é o número $\pi\approx 3.14159265359$. # --------------------------------------------------------------------------- - type: textarea - ref: tut-textarea + ref: tut-textarea title: Resposta em múltiplas linhas de texto text: | 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 @@ ```yaml - type: textarea - ref: tut-textarea + ref: tut-textarea title: Resposta em múltiplas linhas de texto text: | Bla bla bla @@ -335,7 +347,7 @@ return 0; // comentario } ``` - + Faz-se assim: - type: success @@ -345,18 +357,18 @@ Também não conta para avaliação. Já vimos como se introduzem fórmulas LaTeX, também se pode escrever troços de código: - + ```C int main() { printf("Hello world!"); return 0; // comentario } ``` - + # --------------------------------------------------------------------------- - type: warning - ref: tut-warning + ref: tut-warning title: Texto informativo (aviso) text: | Não conta para avaliação. @@ -373,7 +385,7 @@ ```yaml - type: warning - ref: tut-warning + ref: tut-warning title: Texto informativo (aviso) text: | Bla bla bla @@ -390,7 +402,7 @@ # ---------------------------------------------------------------------------- - type: alert - ref: tut-alert + ref: tut-alert title: Texto informativo (perigo) text: | Texto importante. Não conta para avaliação. diff --git a/demo/test-tutorial.yaml b/demo/test-tutorial.yaml index 6c491a1..42f0851 100644 --- a/demo/test-tutorial.yaml +++ b/demo/test-tutorial.yaml @@ -37,24 +37,25 @@ questions_dir: demo # Selected questions will be obtained from these files. # If undefined, all yaml files in questions_dir are loaded (not recommended). files: - - questions/questions-tutorial.yaml + - questions/questions-tutorial.yaml # This is the list of questions that will make up the test. # The order is preserved. # There are several ways to define each question (explained below). questions: - - tut-test - - tut-questions - - - tut-radio - - tut-checkbox - - tut-text - - tut-text-regex - - tut-numeric-interval - - tut-textarea - - - tut-information - - tut-success - - tut-warning - - tut-alert - + - tut-test + - tut-questions + + - tut-radio + - tut-checkbox + - tut-text + - tut-text-regex + - tut-numeric-interval + - ref: tut-textarea + points: 2.0 + + - tut-information + - tut-success + - tut-warning + - tut-alert + diff --git a/templates/review-question.html b/templates/review-question.html index 6ac7778..f967e1f 100644 --- a/templates/review-question.html +++ b/templates/review-question.html @@ -41,8 +41,8 @@ pontos
{{ q['comments'] }} {% if 'solution' in q %} -
- {{ md('**Solução:** ' + q['solution']) }} +
+ {{ md('**Solução:** ' + q['solution']) }} {% end %}

{% else %} @@ -52,8 +52,8 @@ pontos
{{ q['comments'] }} {% if 'solution' in q %} -
- {{ md('**Solução:** ' + q['solution']) }} +
+ {{ md('**Solução:** ' + q['solution']) }} {% end %}

{% end %} @@ -94,6 +94,10 @@ {{ round(q['grade'] * q['points'], 2) }} pontos
{{ q['comments'] }} + {% if 'solution' in q %} +
+ {{ md('**Solução:** ' + q['solution']) }} + {% end %}

{% if t['show_ref'] %} -- libgit2 0.21.2