Commit 189342c67a6e29a913275c16da4731206e8578cd

Authored by Miguel Barão
1 parent 20dac179
Exists in master and in 1 other branch dev

- added commandline option --show-ref

serve.py
... ... @@ -321,8 +321,9 @@ def main():
321 321 argparser = argparse.ArgumentParser(description='Server for online tests. Enrolled students and tests have to be previously configured. Please read the documentation included with this software before running the server.')
322 322 argparser.add_argument('testfile', type=str, nargs='+', help='test/exam in YAML format.') # FIXME only one exam supported at the moment
323 323 argparser.add_argument('--allow-all', action='store_true', help='Students are initially allowed to login (can be denied later)')
324   - argparser.add_argument('--debug', action='store_true',
325   - help='Enable debug messages.')
  324 + argparser.add_argument('--debug', action='store_true', help='Enable debug messages')
  325 + argparser.add_argument('--show-ref', action='store_true', help='Show question references')
  326 +
326 327 arg = argparser.parse_args()
327 328  
328 329 # --- Setup logging
... ... @@ -342,6 +343,7 @@ def main():
342 343 'filename': arg.testfile[0] or '',
343 344 'debug': arg.debug,
344 345 'allow_all': arg.allow_all,
  346 + 'show_ref': arg.show_ref,
345 347 }
346 348  
347 349 try:
... ...
templates/question.html
... ... @@ -22,5 +22,11 @@
22 22 </small>
23 23 </p>
24 24 </div>
  25 +
  26 + {% if show_ref %}
  27 + <div class="card-footer">
  28 + <code>{{ q['ref'] }}</code>
  29 + </div>
  30 + {% end %}
25 31 </div>
26 32 {% end %}
27 33 \ No newline at end of file
... ...
templates/review-question.html
... ... @@ -50,6 +50,11 @@
50 50 {{ q['comments'] }}
51 51 </p>
52 52 {% end %}
  53 +
  54 + {% if t['show_ref'] %}
  55 + <code>{{q['ref']}}</code>
  56 + {% end %}
  57 +
53 58 </div> <!-- card-footer -->
54 59 </div> <!-- card -->
55 60  
... ... @@ -77,13 +82,17 @@
77 82 </small>
78 83 </p>
79 84 </div> <!-- card-body -->
80   -
81 85 <div class="card-footer">
82 86 <p class="text-secondary">
83 87 <i class="fa fa-ban fa-3x" aria-hidden="true"></i>
84 88 {{ round(q['grade'] * q['points'], 2) }} pontos<br>
85 89 {{ q['comments'] }}
86 90 </p>
  91 +
  92 + {% if t['show_ref'] %}
  93 + <code>{{ q['ref'] }}</code>
  94 + {% end %}
  95 +
87 96 </div> <!-- card-footer -->
88 97 </div> <!-- card -->
89 98 {% end %} <!-- if answer not None -->
... ...
templates/test.html
... ... @@ -84,7 +84,7 @@
84 84  
85 85 <form action="/test" method="post" id="test" autocomplete="off">
86 86 {% for i, q in enumerate(t['questions']) %}
87   - {% module Template(templ[q['type']], i=i, q=q, md=md) %}
  87 + {% module Template(templ[q['type']], i=i, q=q, md=md, show_ref=t['show_ref']) %}
88 88 {% end %}
89 89  
90 90 <div class="form-row">
... ...