diff --git a/BUGS.md b/BUGS.md index e60b1de..78d3dc4 100644 --- a/BUGS.md +++ b/BUGS.md @@ -1,9 +1,8 @@ # BUGS -- retornar None quando nao ha alteracoes relativamente à última vez. -ou usar push (websockets?) -- quando scale_max não é 20, as cores das barras continuam a reflectir a escala 0,20 +- review does not show question refs when commandline --show-ref is used but not the test.yaml option. +- 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. - CRITICAL se answer for `i que não preserva whitespace. Necessario adicionar
.
@@ -17,6 +16,8 @@ ou usar push (websockets?)
 
 # TODO
 
+- retornar None quando nao ha alteracoes relativamente à última vez.
+ou usar push (websockets?)
 - mudar ref do test para test_id (ref já é usado nas perguntas)
 - servidor ntpd no x220 para configurar a data/hora dos portateis dell
 - autorização dada, mas teste não disponível até que seja dada ordem para começar.
diff --git a/demo/demo.yaml b/demo/demo.yaml
index 7ca8ce9..541c48e 100644
--- a/demo/demo.yaml
+++ b/demo/demo.yaml
@@ -40,6 +40,9 @@ scale: [0, 5]
 # scale_min: 0
 # scale_points: true
 
+show_ref: true
+debug: false
+
 # ----------------------------------------------------------------------------
 # Base path applied to the questions files and all the scripts
 # including question generators and correctors.
diff --git a/perguntations/serve.py b/perguntations/serve.py
index c6044ca..73ea8f5 100644
--- a/perguntations/serve.py
+++ b/perguntations/serve.py
@@ -482,14 +482,18 @@ class ReviewHandler(BaseHandler):
             raise tornado.web.HTTPError(404)  # Not Found
 
         try:
-            jsonfile = open(path.expanduser(fname))
-        except OSError:
-            logging.error(f'Cannot open "{fname}" for review.')
-        else:
-            with jsonfile:
+            with open(path.expanduser(fname)) as jsonfile:
                 test = json.load(jsonfile)
-            self.render('review.html', t=test, md=md_to_html,
-                        templ=self._templates)
+        except OSError:
+            logging.error('Cannot open "%s" for review.', fname)
+            raise tornado.web.HTTPError(404)  # Not Found
+        except json.JSONDecodeError as exc:
+            logging.error('JSON error in "%s": %s', fname, exc)
+            raise tornado.web.HTTPError(404)  # Not Found
+
+        print(test['show_ref'])
+        self.render('review.html', t=test, md=md_to_html,
+                templ=self._templates)
 
 
 # ----------------------------------------------------------------------------
diff --git a/perguntations/templates/question-information.html b/perguntations/templates/question-information.html
index bc24acb..8d059d6 100644
--- a/perguntations/templates/question-information.html
+++ b/perguntations/templates/question-information.html
@@ -19,8 +19,7 @@
 
 	{% if show_ref %}
   	
- path: {{ q['path'] }}
- file: {{ q['filename'] }}
+ file: {{ q['path'] }}/{{ q['filename'] }}
ref: {{ q['ref'] }} {% end %} \ No newline at end of file diff --git a/perguntations/templates/question.html b/perguntations/templates/question.html index 3482416..acb9471 100644 --- a/perguntations/templates/question.html +++ b/perguntations/templates/question.html @@ -31,8 +31,7 @@ {% if show_ref %} {% end %} diff --git a/perguntations/templates/review-question-information.html b/perguntations/templates/review-question-information.html index b35dbaf..8a62b83 100644 --- a/perguntations/templates/review-question-information.html +++ b/perguntations/templates/review-question-information.html @@ -16,4 +16,9 @@
{{ md(q['text']) }}
+ {% if t['show_ref'] %} +
+ File: {{ q['path'] }}/{{ q['filename'] }}, + Ref: {{ q['ref'] }} + {% end %} \ No newline at end of file diff --git a/perguntations/templates/review-question.html b/perguntations/templates/review-question.html index 13bcb05..d822061 100644 --- a/perguntations/templates/review-question.html +++ b/perguntations/templates/review-question.html @@ -65,7 +65,9 @@ {% end %} {% if t['show_ref'] %} - {{q['ref']}} +
+ File: {{ q['path'] }}/{{ q['filename'] }}, + Ref: {{ q['ref'] }} {% end %} @@ -107,7 +109,9 @@

{% if t['show_ref'] %} - {{ q['ref'] }} +
+ File: {{ q['path'] }}/{{ q['filename'] }}, + Ref: {{ q['ref'] }} {% end %} -- libgit2 0.21.2