diff options
-rw-r--r-- | db/models.py | 2 | ||||
-rw-r--r-- | server/prolog_session.py | 6 | ||||
-rw-r--r-- | server/python_session.py | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/db/models.py b/db/models.py index e5aebb5..4eda2ba 100644 --- a/db/models.py +++ b/db/models.py @@ -43,7 +43,7 @@ class Problem(collections.namedtuple('Problem', ['id', 'language_id', 'problem_g return _general_filter(kwargs, Problem, Problem.__sql_prefix) @staticmethod - def identifier(problem_id): + def get_identifier(problem_id): return _run_sql('select l.identifier, g.identifier, p.identifier from problem p inner join problem_group g on g.id = p.problem_group_id inner join language l on l.id = p.language_id where p.id = %s', (problem_id,), fetch_one=True) # known as Attempt in the original code diff --git a/server/prolog_session.py b/server/prolog_session.py index 798c086..f328670 100644 --- a/server/prolog_session.py +++ b/server/prolog_session.py @@ -89,7 +89,7 @@ class PrologSession(object): self._engine_id = None def hint(self, user_id, problem_id, program): - language, problem_group, problem = Problem.identifier(problem_id) + language, problem_group, problem = Problem.get_identifier(problem_id) # If compilation fails just return compiler messages. engine_id, output = prolog.engine.create(code=program) @@ -110,7 +110,7 @@ class PrologSession(object): return [{'id': 'no_hint'}] def test(self, user_id, problem_id, program): - language, problem_group, problem = Problem.identifier(problem_id) + language, problem_group, problem = Problem.get_identifier(problem_id) problem_module = problems.load_problem(language, problem_group, problem, 'common') solved_problems = [p for p in CodeqUser.solved_problems(user_id, language) @@ -128,7 +128,7 @@ class PrologSession(object): """A "shorthand" method to start a Prolog session, load correct solutions of all user's solved problems and the given program, and ask a query. """ - language, problem_group, problem = Problem.identifier(problem_id) + language, problem_group, problem = Problem.get_identifier(problem_id) problem_module = problems.load_problem(language, problem_group, problem, 'common') solved_problems = [p for p in CodeqUser.solved_problems(user_id, language) diff --git a/server/python_session.py b/server/python_session.py index 24a06f1..641c8ee 100644 --- a/server/python_session.py +++ b/server/python_session.py @@ -46,7 +46,7 @@ class PythonSession(object): self._interpreter = None def hint(self, user_id, problem_id, program): - language, problem_group, problem = Problem.identifier(problem_id) + language, problem_group, problem = Problem.get_identifier(problem_id) # Try problem-specific hints. problem_module = problems.load_problem(language, problem_group, problem, 'common') @@ -59,7 +59,7 @@ class PythonSession(object): return [{'id': 'no_hint'}] def test(self, user_id, problem_id, program): - language, problem_group, problem = Problem.identifier(problem_id) + language, problem_group, problem = Problem.get_identifier(problem_id) problem_module = problems.load_problem(language, problem_group, problem, 'common') try: n_correct, n_all = problem_module.test(program) |