map marker legibility, PDF export blueprint fix, asset list type search
This commit is contained in:
@@ -363,14 +363,20 @@ def list_computers():
|
||||
if exactassetnumber := request.args.get('assetnumber'):
|
||||
query = query.filter(Asset.assetnumber == exactassetnumber)
|
||||
|
||||
# Search filter
|
||||
# Search filter. Covers the type name too - it is a column in the list, so
|
||||
# searching 'Standard' must find the PCs of that type. Outer join so a PC
|
||||
# with no type still matches on its own fields.
|
||||
if search := request.args.get('search'):
|
||||
query = query.filter(
|
||||
pattern = f'%{search}%'
|
||||
query = query.outerjoin(
|
||||
ComputerType, Computer.computertypeid == ComputerType.computertypeid
|
||||
).filter(
|
||||
db.or_(
|
||||
Asset.assetnumber.ilike(f'%{search}%'),
|
||||
Asset.name.ilike(f'%{search}%'),
|
||||
Asset.serialnumber.ilike(f'%{search}%'),
|
||||
Computer.hostname.ilike(f'%{search}%')
|
||||
Asset.assetnumber.ilike(pattern),
|
||||
Asset.name.ilike(pattern),
|
||||
Asset.serialnumber.ilike(pattern),
|
||||
Computer.hostname.ilike(pattern),
|
||||
ComputerType.computertype.ilike(pattern)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user