add sharemetadata to itemKeys. fix queries for boolean keys
This commit is contained in:
parent
cd63cca194
commit
54b3982787
4 changed files with 26 additions and 5 deletions
|
|
@ -176,6 +176,8 @@ class Item(db.Model):
|
|||
value = ''.join(value)
|
||||
value = ox.get_sort_title(value)
|
||||
value = utils.sort_title(value).lower()
|
||||
elif sort_type == 'boolean':
|
||||
pass
|
||||
else:
|
||||
if isinstance(value, list):
|
||||
value = '\n'.join(value)
|
||||
|
|
@ -203,11 +205,16 @@ class Item(db.Model):
|
|||
|
||||
keys = []
|
||||
for key in config['itemKeys']:
|
||||
if key.get('find') or key.get('filter') or key.get('type') in [['string'], 'string']:
|
||||
if key.get('find') or \
|
||||
key.get('filter') or key.get('type') in [['string'], 'string'] or \
|
||||
(key.get('type') == 'boolean' and key.get('sort')):
|
||||
value = self.json().get(key['id'], None)
|
||||
if key.get('filterMap') and value:
|
||||
value = re.compile(key.get('filterMap')).findall(value)
|
||||
if value: value = value[0]
|
||||
if key.get('type') == 'boolean':
|
||||
value = True if value else False
|
||||
value = str(value).lower()
|
||||
if value:
|
||||
keys.append(key['id'])
|
||||
if isinstance(value, dict):
|
||||
|
|
@ -528,6 +535,8 @@ for key in config['itemKeys']:
|
|||
col = sa.Column(sa.Float(), index=True)
|
||||
elif sort_type == 'date':
|
||||
col = sa.Column(sa.DateTime(), index=True)
|
||||
elif sort_type == 'boolean':
|
||||
col = sa.Column(sa.Boolean(), index=True)
|
||||
else:
|
||||
col = sa.Column(sa.String(1000), index=True)
|
||||
setattr(Sort, '%s' % key['id'], col)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue