Fix asset list filters: MAKE→manufacturer, populate customers, expand search, fix assigned_to type
This commit is contained in:
+56
-1
@@ -311,6 +311,61 @@ def get_machine_id(rec):
|
||||
return str(mid).strip()
|
||||
return ""
|
||||
|
||||
def _get_category_for_manufacturer(manufacturer: str) -> str:
|
||||
"""Map manufacturer to asset category for new imports."""
|
||||
if not manufacturer:
|
||||
return "Other"
|
||||
m = manufacturer.strip().upper()
|
||||
|
||||
# Vending Machine
|
||||
for prefix in ["DIXIE NARCO", "NATIONAL", "ROYAL", "VENDO", "AUTOMATIC PRODUCTS",
|
||||
"CRANE", "USI", "WITTERN", "AMS", "ROWE", "SEAGA", "LEKTRO-VEND",
|
||||
"ROYAL VENDORS"]:
|
||||
if m.startswith(prefix):
|
||||
return "Vending Machine"
|
||||
|
||||
# Coffee Brewer
|
||||
for prefix in ["FLAVIA", "KEURIG", "NEWCO", "BUNN", "CAFECTION", "NESPRESSO",
|
||||
"CURTIS", "BRAVILOR", "SMUCKER", "BLOOMFIELD", "STARBUCKS",
|
||||
"AQUACAFE", "SEGAFREDO", "SIMONELLI", "WITTENBORG", "KREA",
|
||||
"TOTAL ONE",
|
||||
"DEJONG", "DE JONG", "DE JOHN"]:
|
||||
if m.startswith(prefix):
|
||||
return "Coffee Brewer"
|
||||
|
||||
# Cooler / Refrigerator
|
||||
for prefix in ["MINUS FORTY", "IMBERA", "ALPINE", "COOLSERV", "VITRIFRIGO",
|
||||
"KOOLTEK", "MTN", "CELSIUS", "NESTLE", "COLD SNAP", "MONSTER",
|
||||
"COKE", "PEPSI", "INTERPURE", "EVERPURE"]:
|
||||
if m.startswith(prefix):
|
||||
return "Cooler"
|
||||
|
||||
# Water Dispenser
|
||||
for prefix in ["WATERLOGIC", "OASIS", "ECOSTREAM", "ECHOSTREAM", "ION",
|
||||
"PURLOGIX", "PURELOGIX", "AVALON", "WELLSYS", "MARCO",
|
||||
"SC WATER"]:
|
||||
if m.startswith(prefix):
|
||||
return "Water Dispenser"
|
||||
|
||||
# Smart Market Kiosk
|
||||
for prefix in ["365 RETAIL MARKETS", "PANOPTYC", "INTUITIVO", "SMART MARKET",
|
||||
"MICRO-MARKET", "OPTCONNECT", "INSTANT SYSTEMS"]:
|
||||
if m.startswith(prefix):
|
||||
return "Smart Market Kiosk"
|
||||
|
||||
# Ice Machine
|
||||
for prefix in ["FOLLETT", "HOSHIZAKI", "EVERSYS"]:
|
||||
if m.startswith(prefix):
|
||||
return "Ice Machine"
|
||||
|
||||
# Beverage Dispenser
|
||||
for prefix in ["BEVI"]:
|
||||
if m.startswith(prefix):
|
||||
return "Beverage Dispenser"
|
||||
|
||||
return "Other"
|
||||
|
||||
|
||||
def map_record_to_asset(rec):
|
||||
"""
|
||||
Map a merged record's fields to the assets table columns.
|
||||
@@ -321,7 +376,7 @@ def map_record_to_asset(rec):
|
||||
name = rec.get("msfs_name") or rec.get("canteen_name") or ""
|
||||
|
||||
# Category / status
|
||||
category = rec.get("canteen_category") or "Other"
|
||||
category = rec.get("canteen_category") or _get_category_for_manufacturer(rec.get("msfs_manufacturer"))
|
||||
status = rec.get("canteen_status") or "active"
|
||||
|
||||
# Make / model / serial
|
||||
|
||||
Reference in New Issue
Block a user