diff options
author | Marko Pušnik <marko.pusnik@guru.si> | 2015-10-12 14:27:52 +0200 |
---|---|---|
committer | Marko Pušnik <marko.pusnik@guru.si> | 2015-10-12 14:27:52 +0200 |
commit | 104a1169a275c4cc023b0cc03abed9103d1b9abd (patch) | |
tree | 429fdd2ea98988260108df097834c0c4cc99b88a /server | |
parent | 3b2eb75e35aea371e4930737a4ce3d884fd3a92d (diff) | |
parent | f7e6d93a890ca74281fffb8e9d59864073c30497 (diff) |
Merge branch 'master' of ssh://212.235.189.51:22122/codeq-server
Diffstat (limited to 'server')
-rw-r--r-- | server/problems.py | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/server/problems.py b/server/problems.py index bc124ca..c63d923 100644 --- a/server/problems.py +++ b/server/problems.py @@ -82,34 +82,3 @@ def solutions_for_problems(language, tuples): except AttributeError as me: pass return '\n'.join(solutions) - -def list_problems(language): - conn = get_connection() - try: - cur = conn.cursor() - try: - cur.arraysize = 1000 - cur.execute('select l.identifier, l.name, g.identifier, g.name, p.identifier, p.name from problem p inner join language l on l.id = p.language_id and l.identifier = \''+language+'\' inner join problem_group g on g.id = p.problem_group_id order by l.identifier, g.identifier, p.identifier') - result = [] - previous_language = '' - previous_group = '' - current_sublist = None - row = cur.fetchone() - while row: - current_language = row[0] - current_group = row[2] - if previous_language != current_language or previous_group != current_group: - current_sublist = [] - result.append({'identifier': {'language': current_language, 'group': current_group}, - 'name': {'language': row[1], 'group': row[3]}, - 'problems': current_sublist}) - previous_group = current_group - previous_language = current_language - current_sublist.append({'identifier': row[4], 'name': row[5]}) - row = cur.fetchone() - return result - finally: - cur.close() - finally: - conn.commit() - return_connection(conn) |