From a1dfe3665a3ebe0f86e0b74bc3ad21a55c7c7faa Mon Sep 17 00:00:00 2001 From: Leo Date: Fri, 22 May 2026 18:34:17 -0400 Subject: [PATCH] feat: add is_disney flag to asset sync - sets is_disney=1 for D- customers INSERT and UPDATE now set is_disney based on whether the customer name starts with 'D-'. Admin DB also backfilled with the same logic. --- cantaloupe_sync.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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),