Commit 1b40ee75b9e98ce77d6e6bbd0398c748a2ccaff2
1 parent
e65f90d3
Exists in
master
and in
1 other branch
- added debug mode.
Showing
2 changed files
with
15 additions
and
6 deletions
Show diff stats
templates/test.html
| @@ -101,6 +101,7 @@ | @@ -101,6 +101,7 @@ | ||
| 101 | 101 | ||
| 102 | <%! | 102 | <%! |
| 103 | import markdown as md | 103 | import markdown as md |
| 104 | + import yaml | ||
| 104 | %> | 105 | %> |
| 105 | <%def name="pretty(text)"> | 106 | <%def name="pretty(text)"> |
| 106 | ${md.markdown(str(text), extensions=['markdown.extensions.tables', | 107 | ${md.markdown(str(text), extensions=['markdown.extensions.tables', |
| @@ -209,31 +210,38 @@ | @@ -209,31 +210,38 @@ | ||
| 209 | % endif # show_hints | 210 | % endif # show_hints |
| 210 | 211 | ||
| 211 | % if t['train_mode'] and 'grade' in q: | 212 | % if t['train_mode'] and 'grade' in q: |
| 212 | - % if q['grade'] > 0.9: | 213 | + % if q['grade'] > 0.99: |
| 213 | <div class="alert alert-success" role="alert"> | 214 | <div class="alert alert-success" role="alert"> |
| 214 | <span class="glyphicon glyphicon-ok" aria-hidden="true"></span> | 215 | <span class="glyphicon glyphicon-ok" aria-hidden="true"></span> |
| 215 | - ${round(q['grade'] * q['points'] / total_points * 20.0, 1)} valores | 216 | + ${round(q['grade'] * q['points'] / total_points * 20.0, 1)} pontos |
| 216 | </div> | 217 | </div> |
| 217 | % elif q['grade'] > 0.5: | 218 | % elif q['grade'] > 0.5: |
| 218 | <div class="alert alert-warning" role="alert"> | 219 | <div class="alert alert-warning" role="alert"> |
| 219 | <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> | 220 | <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> |
| 220 | - ${round(q['grade'] * q['points'] / total_points * 20.0, 1)} valores | 221 | + ${round(q['grade'] * q['points'] / total_points * 20.0, 1)} pontos |
| 221 | </div> | 222 | </div> |
| 222 | % else: | 223 | % else: |
| 223 | <div class="alert alert-danger" role="alert"> | 224 | <div class="alert alert-danger" role="alert"> |
| 224 | <span class="glyphicon glyphicon-remove" aria-hidden="true"></span> | 225 | <span class="glyphicon glyphicon-remove" aria-hidden="true"></span> |
| 225 | - ${round(q['grade'] * q['points'] / total_points * 20.0, 1)} valores | 226 | + ${round(q['grade'] * q['points'] / total_points * 20.0, 1)} pontos |
| 226 | </div> | 227 | </div> |
| 227 | % endif | 228 | % endif |
| 228 | % endif | 229 | % endif |
| 229 | 230 | ||
| 230 | % if t['show_points']: | 231 | % if t['show_points']: |
| 231 | <p class="text-right"> | 232 | <p class="text-right"> |
| 232 | - <small>(${round(q['points'] / total_points * 20.0, 1)} pontos)</small> | 233 | + <small>(Cotação: ${round(q['points'] / total_points * 20.0, 1)} pontos)</small> |
| 233 | <p> | 234 | <p> |
| 234 | % endif | 235 | % endif |
| 235 | 236 | ||
| 236 | </div> <!-- panel-body --> | 237 | </div> <!-- panel-body --> |
| 238 | + % if t['debug']: | ||
| 239 | + <div class="panel-footer"> | ||
| 240 | + <pre> | ||
| 241 | + ${yaml.dump(q)} | ||
| 242 | + </pre> | ||
| 243 | + </div> | ||
| 244 | + % endif | ||
| 237 | </div> <!-- panel --> | 245 | </div> <!-- panel --> |
| 238 | % endif | 246 | % endif |
| 239 | </div> <!-- ui-corner-all custom-corners --> | 247 | </div> <!-- ui-corner-all custom-corners --> |
| @@ -252,7 +260,7 @@ | @@ -252,7 +260,7 @@ | ||
| 252 | <div class="modal-content"> | 260 | <div class="modal-content"> |
| 253 | <div class="modal-header"> | 261 | <div class="modal-header"> |
| 254 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | 262 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> |
| 255 | - <h4 class="modal-title" id="myModalLabel">Deseja submeter o teste?</h4> | 263 | + <h4 class="modal-title">Deseja submeter o teste?</h4> |
| 256 | </div> | 264 | </div> |
| 257 | <div class="modal-body"> | 265 | <div class="modal-body"> |
| 258 | Se submeter, o teste será enviado para classificação e já não poderá voltar atrás. | 266 | Se submeter, o teste será enviado para classificação e já não poderá voltar atrás. |
test.py
| @@ -24,6 +24,7 @@ def read_configuration(filename): | @@ -24,6 +24,7 @@ def read_configuration(filename): | ||
| 24 | test['show_hints'] = bool(test.get('show_hints', False)) | 24 | test['show_hints'] = bool(test.get('show_hints', False)) |
| 25 | test['show_points'] = bool(test.get('show_points', False)) | 25 | test['show_points'] = bool(test.get('show_points', False)) |
| 26 | test['train_mode'] = bool(test.get('train_mode', False)) | 26 | test['train_mode'] = bool(test.get('train_mode', False)) |
| 27 | + test['debug'] = bool(test.get('debug', False)) | ||
| 27 | test['save_answers'] = bool(test.get('save_answers', True)) | 28 | test['save_answers'] = bool(test.get('save_answers', True)) |
| 28 | if test['save_answers']: | 29 | if test['save_answers']: |
| 29 | if 'answers_dir' not in test: | 30 | if 'answers_dir' not in test: |