summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@araneo.org>2015-09-22 12:05:20 +0200
committerTimotej Lazar <timotej.lazar@araneo.org>2015-09-22 12:05:20 +0200
commit0cc91946829c64e894034bdc5cabdd80f983d5be (patch)
tree75a75426f7a712a0e692aafe33dde5a9e8ad40af /server
parent15f35dc1c2eb50a8140f1a0abf45d5aa25fdf66b (diff)
Create the hint-list in individual test functions
This will allow us to add more hints, for example "did you know?"-type information when the program is correct.
Diffstat (limited to 'server')
-rw-r--r--server/prolog_session.py5
-rw-r--r--server/python_session.py5
2 files changed, 4 insertions, 6 deletions
diff --git a/server/prolog_session.py b/server/prolog_session.py
index 8d9926d..ccfb91c 100644
--- a/server/prolog_session.py
+++ b/server/prolog_session.py
@@ -118,10 +118,9 @@ class PrologSession(object):
solved_problems = [p for p in CodeqUser.solved_problems(session.get_uid(), language)
if p != (problem_group, problem)]
try:
- n_correct, n_all = problem_module.test(program, solved_problems)
- hints = [{'id': 'test_results', 'args': {'passed': n_correct, 'total': n_all}}]
+ passed, hints = problem_module.test(self.run, program)
except AttributeError as ex:
- hints = [{'id': 'test_results', 'args': {'passed': 0, 'total': 0}}]
+ hints = [{'id': 'system_error', 'args': {'message': 'test function does not exist'}}]
self._instantiate_and_save_hints(language_module, problem_module, hints)
return hints
diff --git a/server/python_session.py b/server/python_session.py
index 6f2c999..975af7f 100644
--- a/server/python_session.py
+++ b/server/python_session.py
@@ -93,10 +93,9 @@ class PythonSession(object):
problem_module = problems.load_problem(language, problem_group, problem, 'common')
try:
- n_correct, n_all = problem_module.test(self.run, program)
- hints = [{'id': 'test_results', 'args': {'passed': n_correct, 'total': n_all}}]
+ passed, hints = problem_module.test(self.run, program)
except AttributeError as ex:
- hints = [{'id': 'test_results', 'args': {'passed': 0, 'total': 0}}]
+ hints = [{'id': 'system_error', 'args': {'message': 'test function does not exist'}}]
self._instantiate_and_save_hints(language_module, problem_module, hints)
return hints