diff --git a/cantaloupe_sync.py b/cantaloupe_sync.py index f211203..8d0780a 100644 --- a/cantaloupe_sync.py +++ b/cantaloupe_sync.py @@ -700,6 +700,10 @@ def approve_batch(batch_id: int, request: Request): if loc_id: updates["location_id"] = loc_id + # Set Disney flag based on customer name + if cust_name: + updates["is_disney"] = 1 if cust_name.startswith("D-") else 0 + if updates: updates["updated_at"] = "datetime('now')" set_clause = ", ".join( @@ -731,9 +735,9 @@ def approve_batch(batch_id: int, request: Request): make, model, address, building_name, building_number, floor, room, trailer_number, walking_directions, map_link, parking_location, photo_path, - customer_id, location_id, + customer_id, location_id, is_disney, latitude, longitude, geofence_radius_meters) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""", + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""", ( machine_id, str(item.get("serial_number", "")).strip() or "", @@ -755,6 +759,7 @@ def approve_batch(batch_id: int, request: Request): str(item.get("photo_path", "")).strip() or "", cust_id, loc_id, + 1 if cust_name and cust_name.startswith("D-") else 0, _safe_float(item.get("latitude")), _safe_float(item.get("longitude")), _safe_int(item.get("geofence_radius_meters"), 50),