Commit 697db6fd authored by Laurent EL SHAFEY's avatar Laurent EL SHAFEY

Fix subworld bug, increment version number

parent 92e3f32c
......@@ -9,7 +9,7 @@ from setuptools import setup, find_packages
setup(
name='xbob.db.banca',
version='1.0.2',
version='1.0.3',
description='BANCA Database Access API for Bob',
url='http://github.com/bioidiap/xbob.db.banca',
license='GPLv3',
......
......@@ -114,7 +114,7 @@ class Database(xbob.db.verification.utils.SQLiteDatabase, xbob.db.verification.u
# List of the clients
if "world" in groups:
if len(subworld)==1:
q = self.query(Client).join(Subworld).filter(Subworld.name.in_(subworld))
q = self.query(Client).join((Subworld,Client.subworld)).filter(Subworld.name.in_(subworld))
else:
q = self.query(Client).filter(Client.sgroup == 'world')
q = q.filter(Client.gender.in_(genders)).\
......@@ -346,7 +346,7 @@ class Database(xbob.db.verification.utils.SQLiteDatabase, xbob.db.verification.u
if 'world' in groups:
q = self.query(File).join(Client).join((ProtocolPurpose, File.protocolPurposes)).join(Protocol)
if len(subworld) == 1:
q = q.join(Subworld).filter(Subworld.name.in_(subworld))
q = q.join((Subworld,Client.subworld)).filter(Subworld.name.in_(subworld))
q = q.filter(Client.sgroup == 'world').\
filter(and_(Protocol.name.in_(protocol), ProtocolPurpose.sgroup == 'world')).\
filter(Client.language.in_(languages))
......
......@@ -32,6 +32,8 @@ class BancaDatabaseTest(unittest.TestCase):
self.assertEqual(len(db.clients()), 82)
self.assertEqual(len(db.clients(groups='world')), 30)
self.assertEqual(len(db.clients(groups='world', subworld='onethird')), 10)
self.assertEqual(len(db.clients(groups='world', subworld='twothirds')), 20)
self.assertEqual(len(db.clients(groups='dev')), 26)
self.assertEqual(len(db.clients(groups='eval')), 26)
self.assertEqual(len(db.tclients(groups='dev')), 26)
......@@ -47,6 +49,8 @@ class BancaDatabaseTest(unittest.TestCase):
self.assertEqual(len(db.objects()), 6540)
self.assertEqual(len(db.objects(groups='world')), 300)
self.assertEqual(len(db.objects(groups='world', subworld='onethird')), 100)
self.assertEqual(len(db.objects(groups='world', subworld='twothirds')), 200)
self.assertEqual(len(db.objects(groups='dev')), 3120)
self.assertEqual(len(db.objects(groups='eval')), 3120)
......
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