summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/prolog_session.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/server/prolog_session.py b/server/prolog_session.py
index c06c6d0..8d9926d 100644
--- a/server/prolog_session.py
+++ b/server/prolog_session.py
@@ -96,11 +96,13 @@ class PrologSession(object):
language_module = problems.load_language(language, 'common')
problem_module = problems.load_problem(language, problem_group, problem, 'common')
+ solved_problems = [p for p in CodeqUser.solved_problems(session.get_uid(), language)
+ if p != (problem_group, problem)]
hints = []
if hasattr(language_module, 'hint'):
- hints = language_module.hint(program)
+ hints = language_module.hint(program, solved_problems)
if not hints and hasattr(problem_module, 'hint'):
- hints = problem_module.hint(session, program)
+ hints = problem_module.hint(program, solved_problems)
if not hints:
hints = [{'id': 'no_hint'}]
@@ -115,11 +117,8 @@ class PrologSession(object):
solved_problems = [p for p in CodeqUser.solved_problems(session.get_uid(), language)
if p != (problem_group, problem)]
- other_solutions = problems.solutions_for_problems(language, solved_problems)
- code = program + '\n' + other_solutions
-
try:
- n_correct, n_all = problem_module.test(session, code)
+ n_correct, n_all = problem_module.test(program, solved_problems)
hints = [{'id': 'test_results', 'args': {'passed': n_correct, 'total': n_all}}]
except AttributeError as ex:
hints = [{'id': 'test_results', 'args': {'passed': 0, 'total': 0}}]