Commit 0a68032c042a6d288e5d4604d03a9df41f374812
Exists in
master
and in
1 other branch
Merge branch 'master' into dev
Showing
2 changed files
with
13 additions
and
7 deletions
Show diff stats
perguntations/app.py
| ... | ... | @@ -224,8 +224,8 @@ class App(): |
| 224 | 224 | ''' |
| 225 | 225 | Corrects test |
| 226 | 226 | |
| 227 | - ans is a dictionary {question_index: answer, ...} | |
| 228 | - for example: {0:'hello', 1:[1,2]} | |
| 227 | + ans is a dictionary {question_index: answer, ...} with the answers for | |
| 228 | + the complete test. For example: {0:'hello', 1:[1,2]} | |
| 229 | 229 | ''' |
| 230 | 230 | test = self.online[uid]['test'] |
| 231 | 231 | ... | ... |
perguntations/serve.py
| ... | ... | @@ -7,15 +7,16 @@ Uses the tornadoweb framework. |
| 7 | 7 | |
| 8 | 8 | |
| 9 | 9 | # python standard library |
| 10 | -from os import path | |
| 11 | -import sys | |
| 12 | 10 | import base64 |
| 13 | -import uuid | |
| 11 | +import functools | |
| 12 | +import json | |
| 14 | 13 | import logging.config |
| 15 | 14 | import mimetypes |
| 15 | +from os import path | |
| 16 | 16 | import signal |
| 17 | -import functools | |
| 18 | -import json | |
| 17 | +import sys | |
| 18 | +from timeit import default_timer as timer | |
| 19 | +import uuid | |
| 19 | 20 | |
| 20 | 21 | # user installed libraries |
| 21 | 22 | import tornado.ioloop |
| ... | ... | @@ -421,6 +422,7 @@ class TestHandler(BaseHandler): |
| 421 | 422 | builds dictionary ans={0: 'answer0', 1:, 'answer1', ...} |
| 422 | 423 | unanswered questions not included. |
| 423 | 424 | ''' |
| 425 | + timeit_start = timer() # performance timer | |
| 424 | 426 | |
| 425 | 427 | uid = self.current_user |
| 426 | 428 | test = self.testapp.get_student_test(uid) |
| ... | ... | @@ -447,6 +449,10 @@ class TestHandler(BaseHandler): |
| 447 | 449 | |
| 448 | 450 | # show final grade and grades of other tests in the database |
| 449 | 451 | allgrades = self.testapp.get_student_grades_from_all_tests(uid) |
| 452 | + | |
| 453 | + timeit_finish = timer() | |
| 454 | + logging.info(' correction took %fs', timeit_finish-timeit_start) | |
| 455 | + | |
| 450 | 456 | self.render('grade.html', t=test, allgrades=allgrades) |
| 451 | 457 | |
| 452 | 458 | ... | ... |