summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/models.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/db/models.py b/db/models.py
index 2363802..eaf67d7 100644
--- a/db/models.py
+++ b/db/models.py
@@ -62,6 +62,12 @@ class Problem(collections.namedtuple('Problem', ['id', 'language', 'group', 'ide
kwargs = {'p.'+k: v for k, v in kwargs.items()}
return _general_filter(kwargs, Problem, Problem.__sql_prefix, order=Problem.__sql_order)
+ # get a list of problems with the given language identifier
+ @staticmethod
+ def filter_language(language):
+ kwargs = {'l.identifier': language}
+ return _general_filter(kwargs, Problem, Problem.__sql_prefix, order=Problem.__sql_order)
+
# 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 from solution'