Commit 998b5d02 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Fix bug in the selector query when dealing with category and code.

parent c6bbb113
......@@ -134,7 +134,7 @@ class MySelector(SelectorActiveItems):
and year are systematically excluded.
"""
li = ['id_categories', 'year_end', 'year_start']
li = ['id_people_categories', 'id_people_code', 'year_end', 'year_start']
li.extend(exclude_fields)
SelectorActiveItems.__init__(self, table, exclude_fields=li)
......@@ -324,11 +324,19 @@ class MySelector(SelectorActiveItems):
db = table._db
query = SelectorActiveItems.query(self, table)
# category constraint
id_category = self.id_categories
if id_category:
category = db.people_categories[id_category].category
q = db.people_categories.category == category
# people category and code
id_people_code = self.id_people_code
if id_people_code:
q = db.history.id_people_categories == id_people_code
query = (query) & (q)
id_people_category = self.id_people_categories
if id_people_category:
category = db.people_categories[id_people_category].category
qcat = db.people_categories.category==category
myset = {row.id for row in db(qcat).select(db.people_categories.id)}
q = db.history.id_people_categories.belongs(myset)
query = (query) & (q)
return query
......
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