From 28116fd8278bb3b8832f4f5b22c68bd7978c8efd Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Tue, 27 Sep 2016 16:14:00 +0200 Subject: Incorporate some tweaks to the monkey methods --- server/prolog_session.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'server') diff --git a/server/prolog_session.py b/server/prolog_session.py index 6cf6651..6cb1592 100644 --- a/server/prolog_session.py +++ b/server/prolog_session.py @@ -171,8 +171,12 @@ class PrologSession(server.LanguageSession): def _aux_code(self, user_id, problem, program): problem_module = load_problem(problem.language, problem.group, problem.identifier, 'common') used_predicate_identifiers = {make_identifier(name) for name in used_predicates(program)} + # FIXME this currently loads *all* solved predicates, since monkey.fix can + # add goals that require other predicates, which causes the modified + # program to fail if the predicate is not loaded (because it did not appear + # in the initial program). dependencies = {p for p in CodeqUser.solved_problems(user_id, problem.language) - if p[1] != problem.identifier and p[1] in used_predicate_identifiers} + if p[1] != problem.identifier} # TODO and p[1] in used_predicate_identifiers} return ('\n' + solutions_for_problems(problem.language, dependencies) + '\n' + get_facts(problem.language, problem_module)) -- cgit v1.2.1