map marker legibility, PDF export blueprint fix, asset list type search
This commit is contained in:
@@ -240,15 +240,24 @@ def list_printers():
|
||||
if exactassetnumber := request.args.get('assetnumber'):
|
||||
query = query.filter(Asset.assetnumber == exactassetnumber)
|
||||
|
||||
# Search filter
|
||||
# Search filter. Type and model are columns in the list, so searching
|
||||
# 'Thermal' must find the thermal printers. Outer joins so a printer missing
|
||||
# either still matches on its own fields.
|
||||
if search := request.args.get('search'):
|
||||
query = query.filter(
|
||||
pattern = f'%{search}%'
|
||||
query = query.outerjoin(
|
||||
PrinterType, Printer.printertypeid == PrinterType.printertypeid
|
||||
).outerjoin(
|
||||
Model, Printer.modelnumberid == Model.modelnumberid
|
||||
).filter(
|
||||
db.or_(
|
||||
Asset.assetnumber.ilike(f'%{search}%'),
|
||||
Asset.name.ilike(f'%{search}%'),
|
||||
Asset.serialnumber.ilike(f'%{search}%'),
|
||||
Printer.hostname.ilike(f'%{search}%'),
|
||||
Printer.windowsname.ilike(f'%{search}%')
|
||||
Asset.assetnumber.ilike(pattern),
|
||||
Asset.name.ilike(pattern),
|
||||
Asset.serialnumber.ilike(pattern),
|
||||
Printer.hostname.ilike(pattern),
|
||||
Printer.windowsname.ilike(pattern),
|
||||
PrinterType.printertype.ilike(pattern),
|
||||
Model.modelnumber.ilike(pattern)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user