summaryrefslogtreecommitdiff
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
parente6db8c7aab74d25a669db857dbbef6a151ee93af (diff)
Use psycopg's builtin support for jsonb columns
-rw-r--r--db/models.py9
-rw-r--r--readme.md5
2 files changed, 9 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):
diff --git a/readme.md b/readme.md
index 8e5d200..d344e79 100644
--- a/readme.md
+++ b/readme.md
@@ -1,6 +1,11 @@
Installation
============
+Minimum versions of required packages:
+
+ - python3-psycopg2 ≥ 2.5.4
+ - swi-prolog ≥ 7.3
+
These instructions assume you are running Debian Jessie. Install dependencies:
apt install apache2 nodejs npm python3 python3-ply python3-psycopg2 python3-termcolor