Commit d2ec62c2 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Merge branch '4-bug-track-lhcbfrance' into 'master'

4 bug track lhcbfrance

* Fix few bugs
* Close #4

See merge request !6
parents c6bbb113 3516b504
......@@ -635,6 +635,8 @@ class List(BaseReport):
if not el.dataIndex:
continue
tablename, fieldname, keyname = el.map
cfg = Storage(name=el.dataIndex)
# the pseudo field year
......@@ -645,9 +647,24 @@ class List(BaseReport):
elif el.eval:
cfg.type = 'float'
# json type database field
elif keyname:
xtype = el.xtype
if xtype == 'gridcolumn':
cfg.type = 'string'
elif xtype == 'booleancolumn':
cfg.type = 'boolean'
elif xtype == 'datecolumn':
cfg.type = 'date'
elif xtype == 'numbercolumn':
cfg.type = 'float'
# standard database field, extract the type from the database field
else:
tablename, fieldname, keyname = el.map
dbfield = db[tablename][fieldname]
cfg.type = dbfield.type
......
......@@ -134,9 +134,14 @@ class MySelector(SelectorActiveItems):
and year are systematically excluded.
"""
li = ['id_categories', 'year_end', 'year_start']
li.extend(exclude_fields)
li = ['id_object_categories',
'id_object_code',
'id_people_categories',
'id_people_code',
'year_end',
'year_start']
li.extend(exclude_fields)
SelectorActiveItems.__init__(self, table, exclude_fields=li)
# add virtual fields
......@@ -324,13 +329,36 @@ 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
# object category and code
id_object_code = self.id_object_code
if id_object_code:
q = db.history.id_object_categories == id_object_code
query = (query) & (q)
id_object_category = self.id_object_categories
if id_object_category:
category = db.object_categories[id_object_category].category
qcat = db.object_categories.category == category
myset = {row.id for row in db(qcat).select(db.object_categories.id)}
q = db.history.id_object_categories.belongs(myset)
query = (query) & (q)
# 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 &= 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 &= 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