summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2016-01-05 18:05:47 +0100
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2016-01-05 18:05:47 +0100
commit547b44c17b058e5605b31fb8b86abf9b2b894608 (patch)
treef21c7f54f2243b6cc49bcc037689aad0941c2ee9 /db
parent9acb5e65c128a3d06567f2142a1bf603780187fc (diff)
monkey.edits: only add solutions to predicates that are actually used when testing
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'