From 46b7b01e98aad5701fea2c5ed7f7d27f9ae4e06b Mon Sep 17 00:00:00 2001 From: User Date: Sun, 1 Feb 2026 03:52:59 +0100 Subject: [PATCH] fix: exclude position offsets from peer sync Position offsets (custom_lat_offset, custom_lon_offset) are relative to each scanner's location, so syncing them between scanners would place devices incorrectly. Only sync: floor, label, favorite, notes. Co-Authored-By: Claude Opus 4.5 --- src/rf_mapper/database.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/rf_mapper/database.py b/src/rf_mapper/database.py index 4993801..2045ee0 100644 --- a/src/rf_mapper/database.py +++ b/src/rf_mapper/database.py @@ -929,18 +929,19 @@ class DeviceDatabase: since: ISO timestamp. If None, returns all devices with sync-relevant data. Returns: - List of device dicts with sync-relevant fields + List of device dicts with sync-relevant fields. + Note: Position offsets are NOT synced as they are relative to each scanner's location. """ conn = self._get_connection() cursor = conn.cursor() + # Don't sync position offsets - they're relative to each scanner's location query = """ SELECT device_id, device_type, name, ssid, manufacturer, - custom_label, assigned_floor, custom_lat_offset, custom_lon_offset, - is_favorite, notes, updated_at + custom_label, assigned_floor, is_favorite, notes, updated_at FROM devices WHERE (custom_label IS NOT NULL OR assigned_floor IS NOT NULL - OR custom_lat_offset IS NOT NULL OR is_favorite = 1 OR notes IS NOT NULL) + OR is_favorite = 1 OR notes IS NOT NULL) """ params = [] @@ -1001,13 +1002,7 @@ class DeviceDatabase: updates.append("assigned_floor = ?") params.append(dev["assigned_floor"]) - if dev.get("custom_lat_offset") is not None: - updates.append("custom_lat_offset = ?") - params.append(dev["custom_lat_offset"]) - - if dev.get("custom_lon_offset") is not None: - updates.append("custom_lon_offset = ?") - params.append(dev["custom_lon_offset"]) + # Note: position offsets are NOT synced - they're relative to each scanner if dev.get("is_favorite") is not None: updates.append("is_favorite = ?")