Commit 74635609c76e6982adc412e7eb82fa7ba23cdf2f
1 parent
729b68db
Exists in
master
and in
1 other branch
- handle JSON exception
- show file and ref both in the test and review
Showing
7 changed files
with
31 additions
and
16 deletions
Show diff stats
BUGS.md
1 | 1 | |
2 | 2 | # BUGS |
3 | 3 | |
4 | -- retornar None quando nao ha alteracoes relativamente à última vez. | |
5 | -ou usar push (websockets?) | |
6 | -- quando scale_max não é 20, as cores das barras continuam a reflectir a escala 0,20 | |
4 | +- review does not show question refs when commandline --show-ref is used but not the test.yaml option. | |
5 | +- em admin, quando scale_max não é 20, as cores das barras continuam a reflectir a escala 0,20. a tabela teste na DB não tem a escala desse teste. | |
7 | 6 | - CRITICAL se answer for `i<n` a revisão de provas mostra apenas i (interpreta `<` como tag?) |
8 | 7 | - na pagina grade.html as barras estao normalizadas para os limites scale_min e max do teste actual e nao do realizado. |
9 | 8 | - codigo `hello world` nao esta a preservar o whitespace. O renderer de markdown gera a tag <code> que não preserva whitespace. Necessario adicionar <pre>. |
... | ... | @@ -17,6 +16,8 @@ ou usar push (websockets?) |
17 | 16 | |
18 | 17 | # TODO |
19 | 18 | |
19 | +- retornar None quando nao ha alteracoes relativamente à última vez. | |
20 | +ou usar push (websockets?) | |
20 | 21 | - mudar ref do test para test_id (ref já é usado nas perguntas) |
21 | 22 | - servidor ntpd no x220 para configurar a data/hora dos portateis dell |
22 | 23 | - autorização dada, mas teste não disponível até que seja dada ordem para começar. | ... | ... |
demo/demo.yaml
... | ... | @@ -40,6 +40,9 @@ scale: [0, 5] |
40 | 40 | # scale_min: 0 |
41 | 41 | # scale_points: true |
42 | 42 | |
43 | +show_ref: true | |
44 | +debug: false | |
45 | + | |
43 | 46 | # ---------------------------------------------------------------------------- |
44 | 47 | # Base path applied to the questions files and all the scripts |
45 | 48 | # including question generators and correctors. | ... | ... |
perguntations/serve.py
... | ... | @@ -482,14 +482,18 @@ class ReviewHandler(BaseHandler): |
482 | 482 | raise tornado.web.HTTPError(404) # Not Found |
483 | 483 | |
484 | 484 | try: |
485 | - jsonfile = open(path.expanduser(fname)) | |
486 | - except OSError: | |
487 | - logging.error(f'Cannot open "{fname}" for review.') | |
488 | - else: | |
489 | - with jsonfile: | |
485 | + with open(path.expanduser(fname)) as jsonfile: | |
490 | 486 | test = json.load(jsonfile) |
491 | - self.render('review.html', t=test, md=md_to_html, | |
492 | - templ=self._templates) | |
487 | + except OSError: | |
488 | + logging.error('Cannot open "%s" for review.', fname) | |
489 | + raise tornado.web.HTTPError(404) # Not Found | |
490 | + except json.JSONDecodeError as exc: | |
491 | + logging.error('JSON error in "%s": %s', fname, exc) | |
492 | + raise tornado.web.HTTPError(404) # Not Found | |
493 | + | |
494 | + print(test['show_ref']) | |
495 | + self.render('review.html', t=test, md=md_to_html, | |
496 | + templ=self._templates) | |
493 | 497 | |
494 | 498 | |
495 | 499 | # ---------------------------------------------------------------------------- | ... | ... |
perguntations/templates/question-information.html
... | ... | @@ -19,8 +19,7 @@ |
19 | 19 | |
20 | 20 | {% if show_ref %} |
21 | 21 | <hr> |
22 | - path: <code>{{ q['path'] }}</code><br> | |
23 | - file: <code>{{ q['filename'] }}</code><br> | |
22 | + file: <code>{{ q['path'] }}/{{ q['filename'] }}</code><br> | |
24 | 23 | ref: <code>{{ q['ref'] }}</code> |
25 | 24 | {% end %} |
26 | 25 | </div> |
27 | 26 | \ No newline at end of file | ... | ... |
perguntations/templates/question.html
... | ... | @@ -31,8 +31,7 @@ |
31 | 31 | |
32 | 32 | {% if show_ref %} |
33 | 33 | <div class="card-footer"> |
34 | - path: <code>{{ q['path'] }}</code><br> | |
35 | - file: <code>{{ q['filename'] }}</code><br> | |
34 | + file: <code>{{ q['path'] }}/{{ q['filename'] }}</code><br> | |
36 | 35 | ref: <code>{{ q['ref'] }}</code> |
37 | 36 | </div> |
38 | 37 | {% end %} | ... | ... |
perguntations/templates/review-question-information.html
perguntations/templates/review-question.html
... | ... | @@ -65,7 +65,9 @@ |
65 | 65 | {% end %} |
66 | 66 | |
67 | 67 | {% if t['show_ref'] %} |
68 | - <code>{{q['ref']}}</code> | |
68 | + <hr> | |
69 | + File: <code>{{ q['path'] }}/{{ q['filename'] }}</code>, | |
70 | + Ref: <code>{{ q['ref'] }}</code> | |
69 | 71 | {% end %} |
70 | 72 | |
71 | 73 | </div> <!-- card-footer --> |
... | ... | @@ -107,7 +109,9 @@ |
107 | 109 | </p> |
108 | 110 | |
109 | 111 | {% if t['show_ref'] %} |
110 | - <code>{{ q['ref'] }}</code> | |
112 | + <hr> | |
113 | + File: <code>{{ q['path'] }}/{{ q['filename'] }}</code>, | |
114 | + Ref: <code>{{ q['ref'] }}</code> | |
111 | 115 | {% end %} |
112 | 116 | |
113 | 117 | </div> <!-- card-footer --> | ... | ... |