From 74635609c76e6982adc412e7eb82fa7ba23cdf2f Mon Sep 17 00:00:00 2001
From: Miguel Barão .
@@ -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 @@
+ 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 @@
{{ q['ref'] }}
+ {{ q['path'] }}/{{ q['filename'] }}
,
+ Ref: {{ q['ref'] }}
{% end %}
--
libgit2 0.21.2