summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2015-10-30 14:12:47 +0100
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2015-10-30 14:12:47 +0100
commitf66fcacc2aaaa3adbc2f81d2ac740e112c496046 (patch)
tree81b759c6a3b992c63d7cbbe7bd7a9ccdcab31705 /db
parente6db8c7aab74d25a669db857dbbef6a151ee93af (diff)
Use psycopg's builtin support for jsonb columns
Diffstat (limited to 'db')
-rw-r--r--db/models.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/db/models.py b/db/models.py
index f5c690d..23152c3 100644
--- a/db/models.py
+++ b/db/models.py
@@ -50,20 +50,19 @@ class Problem(collections.namedtuple('Problem', ['id', 'language', 'group', 'ide
# known as Attempt in the original code
class Solution(collections.namedtuple('Solution', ['id', 'done', 'content', 'problem_id', 'codeq_user_id', 'trace'])):
- __sql_prefix = 'select id, done, content, problem_id, codeq_user_id, trace::text from solution'
- __row_conversion = lambda row: (row[0], row[1], row[2], row[3], row[4], json.loads(row[5]))
+ __sql_prefix = 'select id, done, content, problem_id, codeq_user_id, trace from solution'
@staticmethod
def get(**kwargs):
- return _general_get(kwargs, Solution, Solution.__sql_prefix, Solution.__row_conversion)
+ return _general_get(kwargs, Solution, Solution.__sql_prefix)
@staticmethod
def list():
- return _general_list(Solution, Solution.__sql_prefix, Solution.__row_conversion)
+ return _general_list(Solution, Solution.__sql_prefix)
@staticmethod
def filter(**kwargs):
- return _general_filter(kwargs, Solution, Solution.__sql_prefix, Solution.__row_conversion)
+ return _general_filter(kwargs, Solution, Solution.__sql_prefix)
def _no_row_conversion(row):