diff options
author | Timotej Lazar <timotej.lazar@araneo.org> | 2015-08-28 18:28:42 +0200 |
---|---|---|
committer | Timotej Lazar <timotej.lazar@araneo.org> | 2015-08-28 18:28:42 +0200 |
commit | fd27a749fa48a9f611850c1e598b3f8e3d379439 (patch) | |
tree | 3428acc945c11b0a06a15323ecfad69f168f9feb | |
parent | 29892da19ae7c1b2777f48bce4674262d2a19cef (diff) |
Handle test results as a static hint
-rw-r--r-- | server/prolog_session.py | 4 | ||||
-rw-r--r-- | wsgi_server.py | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/server/prolog_session.py b/server/prolog_session.py index d83d62d..798c086 100644 --- a/server/prolog_session.py +++ b/server/prolog_session.py @@ -120,9 +120,9 @@ class PrologSession(object): try: n_correct, n_all = problem_module.test(code) - return ['Passed {} / {} tests.'.format(n_correct, n_all)] + return [{'id': 'test_results', 'args': {'passed': n_correct, 'total': n_all}}] except AttributeError as ex: - return ['No test is defined for this problem'] + return [{'id': 'test_results', 'args': {'passed': 0, 'total': 0}}] def run_for_user(self, user_id, problem_id, program, query): """A "shorthand" method to start a Prolog session, load correct solutions of all user's solved diff --git a/wsgi_server.py b/wsgi_server.py index 50676b4..4acb76d 100644 --- a/wsgi_server.py +++ b/wsgi_server.py @@ -171,7 +171,7 @@ class Test(CodeqService): prolog = session.get_prolog() messages = prolog.test(session.get_uid(), problem_id, program) - return {'code': 0, 'message': 'ok', 'terminal': {'messages': messages}} + return {'code': 0, 'message': 'ok', 'hints': messages} class GetProblem(CodeqService): def process(self, js, session): |