summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--db/models.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/db/models.py b/db/models.py
index dcd17af..9ebc155 100644
--- a/db/models.py
+++ b/db/models.py
@@ -23,6 +23,21 @@ class CodeqUser(collections.namedtuple('CodeqUser', ['id', 'username', 'password
def filter(**kwargs):
return _general_filter(kwargs, CodeqUser, CodeqUser.__sql_prefix)
+class Problem(collections.namedtuple('Problem', ['id', 'language_id', 'problem_group_id', 'name', 'identifier', 'is_visible'])):
+ __sql_prefix = 'select id, language_id, problem_group_id, name, identifier, is_visible from problem'
+
+ @staticmethod
+ def get(**kwargs):
+ return _general_get(kwargs, Problem, Problem.__sql_prefix)
+
+ @staticmethod
+ def list():
+ return _general_list(Problem, Problem.__sql_prefix)
+
+ @staticmethod
+ def filter(**kwargs):
+ return _general_filter(kwargs, Problem, Problem.__sql_prefix)
+
# 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'