Commit 189342c67a6e29a913275c16da4731206e8578cd

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

- added commandline option --show-ref

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