summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/problems.py31
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)