Commit 4cd9233f authored by mgbarrero's avatar mgbarrero

fixes on queries models

parent 82ec5716
......@@ -59,7 +59,7 @@ class Database(bob.db.verification.utils.SQLiteDatabase,bob.db.verification.util
return ProtocolPurpose.group_choices
def clients(self, protocol=None, groups=None):
def clients(self, protocol=None, groups='eval'):
"""Returns a list of :py:class:`.Client` for the specific query by the user.
Keyword Parameters:
......@@ -78,7 +78,11 @@ class Database(bob.db.verification.utils.SQLiteDatabase,bob.db.verification.util
"""groups = self.__group_replace_eval_by_genuine__(groups)
groups = self.check_parameters_for_validity(groups, "group", self.client_groups())"""
# List of the clients
q = self.query(Client)
#q = self.query(Client)
if (protocol):
q = self.query(Client).join(File).join((ProtocolPurpose, File.protocolPurposes)).join(Protocol).filter(and_(Protocol.name.in_((protocol,)), ProtocolPurpose.sgroup.in_((groups,))))
else:
q = self.query(Client)
"""if groups:
q = q.filter(Client.sgroup.in_(groups))"""
q = q.order_by(Client.id)
......
......@@ -27,6 +27,10 @@ class kboc16DatabaseTest(unittest.TestCase):
assert len(db.groups()) == 1
assert len(db.clients()) == 300
assert len(db.clients(groups='eval')) ==300
assert len(db.clients(protocol = 'A', groups='eval')) == 300
assert len(db.clients(protocol = 'A')) == 300
assert len(db.clients(protocol = 'D', groups='eval')) == 100
assert len(db.clients(protocol = 'D')) == 100
assert len(db.models()) == 300
assert len(db.models(groups='eval')) == 300
assert len(db.models(protocol = 'A', groups='eval')) == 300
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment