summaryrefslogtreecommitdiff
path: root/kpov_judge/web
diff options
context:
space:
mode:
authorgasperfele@fri1.uni-lj.si <gasperfele@fri1.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414>2015-04-01 20:32:28 +0000
committergasperfele@fri1.uni-lj.si <gasperfele@fri1.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414>2015-04-01 20:32:28 +0000
commit53fea983a90447865c429c2573bfb36cba179054 (patch)
tree42a0fa57a43103378144607d16e575e82071f7e1 /kpov_judge/web
parent2fe40ec78ce6ab3a8c2c5659713b7f947a5686fc (diff)
added hints to task results
git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@296 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414
Diffstat (limited to 'kpov_judge/web')
-rwxr-xr-xkpov_judge/web/kpov_judge/kpov_judge.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/kpov_judge/web/kpov_judge/kpov_judge.py b/kpov_judge/web/kpov_judge/kpov_judge.py
index ef7d542..b2636e2 100755
--- a/kpov_judge/web/kpov_judge/kpov_judge.py
+++ b/kpov_judge/web/kpov_judge/kpov_judge.py
@@ -56,6 +56,7 @@ def auth_greeting():
return "To je past!" + str(flask.app.request.__dict__)
def results_post(task_id, results):
+ student_id = flask.app.request.environ.get('REMOTE_USER', 'Nobody')
db = g.db
params = db.task_params.find_one({'task_id': task_id, 'student_id': student_id})
if params is None:
@@ -72,6 +73,7 @@ def results_post(task_id, results):
if param_meta.get('w', False) and param_name in user_params:
params[param_name] = user_params[param_name]
task_check_source = db.task_checkers.find_one({'task_id':task_id})
+ hints = []
if task_check_source is None:
task_check_source = dummy_checker
else:
@@ -79,16 +81,17 @@ def results_post(task_id, results):
try:
task_check_code = compile(task_check_source, 'checker.py', 'exec')
exec(task_check_code)
- res = task_check(results, params)
+ res, hints = task_check(results, params)
except Exception, e:
- res = "Checker crashed: " + str(e)
+ hints += ["Checker crashed: " + str(e)]
+ res = 0
# flask.app.logger.error(str(e))
if (type(res) is int and res > 0):
res_status = 'OK'
else:
res_status = 'NOT OK'
- db.results.insert({'task_id': task_id, 'result': res, 'status': res_status,'student_id': student_id, 'response': results, 'time': datetime.datetime.now()})
- return {'result': res, 'status': res_status}
+ db.results.insert({'task_id': task_id, 'result': res, 'hints': hints, 'status': res_status,'student_id': student_id, 'response': results, 'time': datetime.datetime.now()})
+ return {'result': res, 'hints': hints, 'status': res_status}
def results_dict(task_id):
student_id = flask.app.request.environ.get('REMOTE_USER', 'Nobody')