Commit 8c6a2bf8bc7101a50da6802ed4acc3bd1b565827

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

- show student ID in the test jumbotron, so that if saved to file will contain student id.

- add update.sh script with the main commands to update perguntations
- other minor changes
BUGS.md
1 1  
2 2 # BUGS
3 3  
4   -- cookies existe um perguntations_user e um user. De onde vem o user?
5 4 - nao esta a mostrar imagens?? internal server error?
6   -- JOBE correct async
7   -- esta a corrigir código JOBE mesmo que nao tenha respondido???
  5 +- guardar testes em JSON assim que sao atribuidos aos alunos (ou guardados inicialmente com um certo nome, e atribuidos posteriormente ao aluno).
  6 +- cookies existe um perguntations_user e um user. De onde vem o user?
8 7 - QuestionCode falta reportar nos comments os vários erros que podem ocorrer (timeout, etc)
9   -
10 8 - algumas vezes a base de dados guarda o mesmo teste em duplicado. ver se dois submits dao origem a duas correcções.
11 9 talvez a base de dados devesse ter como chave do teste um id que fosse único desse teste particular (não um auto counter, nem ref do teste)
12 10 - em caso de timeout na submissão (e.g. JOBE ou script nao responde) a correcção não termina e o teste não é guardado.
... ... @@ -19,11 +17,12 @@ talvez a base de dados devesse ter como chave do teste um id que fosse único de
19 17 - a revisao do teste não mostra as imagens.
20 18 - Test.reset_answers() unused.
21 19 - teste nao esta a mostrar imagens de vez em quando.???
22   -- testar as perguntas todas no início do teste como o aprendizations.
23 20 - show-ref nao esta a funcionar na correccao (pelo menos)
24 21  
25 22 # TODO
26 23  
  24 +- JOBE correct async
  25 +- esta a corrigir código JOBE mesmo que nao tenha respondido???
27 26 - permitir remover alunos que estão online para poderem comecar de novo.
28 27 - guardar nota final grade truncado em zero e sem ser truncado (quando é necessário fazer correcções à mão às perguntas, é necessário o valor não truncado)
29 28 - stress tests. use https://locust.io
... ... @@ -74,6 +73,8 @@ ou usar push (websockets?)
74 73  
75 74 # FIXED
76 75  
  76 +- testar as perguntas todas no início do teste como o aprendizations.
  77 +- adicionar identificacao do aluno no jumbotron inicial do teste, para que ao imprimir para pdf a identificacao do aluno venha escrita no documento.
77 78 - internal server error quando em --review, download csv detalhado.
78 79 - perguntas repetidas (mesma ref) dao asneira, porque a referencia é usada como chave em varios sitios e as chaves nao podem ser dupplicadas.
79 80 da asneira pelo menos na funcao get_questions_csv. na base de dados tem de estar registado tb o numero da pergunta, caso contrario é impossível saber a qual corresponde.
... ...
perguntations/templates/question-checkbox.html
... ... @@ -8,7 +8,7 @@
8 8 <a class="list-group-item">
9 9 <div class="d-flex flex-row">
10 10 <div class="p-2">
11   - <input type="checkbox" id="{{i}}:{{n}}" name="{{i}}" value="{{n}}">
  11 + <input type="checkbox" id="{{i}}:{{n}}" name="{{i}}" value="{{n}}" autocomplete="off">
12 12 </div>
13 13 <div class="p-2">
14 14 <label for="{{i}}:{{n}}">{{ md(opt) }}</label>
... ... @@ -18,4 +18,4 @@
18 18 {% end %}
19 19 </div>
20 20 </fieldset>
21   -{% end %}
22 21 \ No newline at end of file
  22 +{% end %}
... ...
perguntations/templates/question-radio.html
... ... @@ -8,7 +8,7 @@
8 8 <a class="list-group-item">
9 9 <div class="d-flex flex-row">
10 10 <div class="p-2">
11   - <input type="radio" id="{{i}}:{{n}}" name="{{i}}" value="{{n}}">
  11 + <input type="radio" id="{{i}}:{{n}}" name="{{i}}" value="{{n}}" autocomplete="off">
12 12 </div>
13 13 <div class="p-2">
14 14 <label for="{{i}}:{{n}}">{{ md(opt) }}</label>
... ... @@ -18,4 +18,4 @@
18 18 {% end %}
19 19 </div>
20 20 </fieldset>
21   -{% end %}
22 21 \ No newline at end of file
  22 +{% end %}
... ...
perguntations/templates/question-text.html
... ... @@ -2,6 +2,6 @@
2 2  
3 3 {% block answer %}
4 4 <fieldset data-role="controlgroup">
5   - <input type="text" class="form-control" id="{{i}}" name="{{i}}" value="">
  5 + <input type="text" class="form-control" id="{{i}}" name="{{i}}" value="" autocomplete="off">
6 6 </fieldset>
7 7 {% end %}
... ...
perguntations/templates/question-textarea.html
... ... @@ -2,6 +2,6 @@
2 2  
3 3 {% block answer %}
4 4  
5   -<textarea class="form-control" name="{{i}}">{{q['answer'] or ''}}</textarea><br />
  5 +<textarea class="form-control" name="{{i}}" autocomplete="off">{{q['answer'] or ''}}</textarea><br />
6 6  
7 7 {% end %}
... ...
perguntations/templates/test.html
... ... @@ -88,11 +88,18 @@
88 88 <div class="container">
89 89  
90 90 <div class="jumbotron">
91   - <h1 class="display-5">{{ t['title'] }}</h1>
92   -
  91 + <h3 class="display-5">{{ t['title'] }}</h3>
93 92 <hr>
94 93  
95   - <h5>
  94 + <div class="row">
  95 + <label for="nome" class="col-sm-3">Nome:</label>
  96 + <div class="col-sm-9" id="nome">{{ escape(t['student']['name']) }}</div>
  97 + </div>
  98 + <div class="row">
  99 + <label for="numero" class="col-sm-3">Número:</label>
  100 + <div class="col-sm-9" id="numero">{{ escape(t['student']['number']) }}</div>
  101 + </div>
  102 +
96 103 <div class="row">
97 104 <label for="duracao" class="col-sm-3">Duração:</label>
98 105 <div class="col-sm-9" id="duracao">{{ str(t['duration'])+' minutos' if t['duration'] > 0 else 'sem limite de tempo' }}</div>
... ... @@ -101,10 +108,9 @@
101 108 <label for="submissao" class="col-sm-3">Submissão:</label>
102 109 <div class="col-sm-9" id="submissao">{{ 'automática no fim do tempo' if t['autosubmit'] else 'manual' }}</div>
103 110 </div>
104   - </h5>
105 111 </div>
106 112  
107   - <form action="/" method="post" id="test" autocomplete="off">
  113 + <form action="/" method="post" id="test">
108 114 {% module xsrf_form_html() %}
109 115  
110 116 {% for i, q in enumerate(t['questions']) %}
... ...
perguntations/testfactory.py
... ... @@ -234,7 +234,7 @@ class TestFactory(dict):
234 234  
235 235 if question['type'] in ('code', 'textarea'):
236 236 if 'tests_right' in question:
237   - for i, right_answer in enumerate(question['tests_right']):
  237 + for tnum, right_answer in enumerate(question['tests_right']):
238 238 try:
239 239 question.set_answer(right_answer)
240 240 question.correct()
... ... @@ -243,11 +243,11 @@ class TestFactory(dict):
243 243 raise TestFactoryException(msg) from exc
244 244  
245 245 if question['grade'] == 1.0:
246   - logger.info(' test %i Ok', i)
  246 + logger.info(' test %i Ok', tnum)
247 247 else:
248   - logger.error(' TEST %i IS WRONG!!!', i)
  248 + logger.error(' TEST %i IS WRONG!!!', tnum)
249 249 elif 'tests_wrong' in question:
250   - for i, wrong_answer in enumerate(question['tests_wrong']):
  250 + for tnum, wrong_answer in enumerate(question['tests_wrong']):
251 251 try:
252 252 question.set_answer(wrong_answer)
253 253 question.correct()
... ... @@ -256,9 +256,9 @@ class TestFactory(dict):
256 256 raise TestFactoryException(msg) from exc
257 257  
258 258 if question['grade'] < 1.0:
259   - logger.info(' test %i Ok', i)
  259 + logger.info(' test %i Ok', tnum)
260 260 else:
261   - logger.error(' TEST %i IS WRONG!!!', i)
  261 + logger.error(' TEST %i IS WRONG!!!', tnum)
262 262 else:
263 263 try:
264 264 question.set_answer('')
... ...
update.sh 0 → 100755
... ... @@ -0,0 +1,6 @@
  1 +#!/bin/sh
  2 +
  3 +git pull
  4 +npm update
  5 +pip install -U .
  6 +
... ...