map marker legibility, PDF export blueprint fix, asset list type search
This commit is contained in:
@@ -354,13 +354,17 @@ def list_assets():
|
||||
if request.args.get('active', 'true').lower() != 'false':
|
||||
query = query.filter(Asset.isactive == True)
|
||||
|
||||
# Search filter
|
||||
# Search filter. The asset type is a column in the list, so it has to be
|
||||
# searchable. Matched via .has() (a correlated EXISTS) rather than a join,
|
||||
# because the type-name filter below joins AssetType itself.
|
||||
if search := request.args.get('search'):
|
||||
pattern = f'%{search}%'
|
||||
query = query.filter(
|
||||
db.or_(
|
||||
Asset.assetnumber.ilike(f'%{search}%'),
|
||||
Asset.name.ilike(f'%{search}%'),
|
||||
Asset.serialnumber.ilike(f'%{search}%')
|
||||
Asset.assetnumber.ilike(pattern),
|
||||
Asset.name.ilike(pattern),
|
||||
Asset.serialnumber.ilike(pattern),
|
||||
Asset.assettype.has(AssetType.assettype.ilike(pattern))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user