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 <noreply@anthropic.com>
This commit is contained in:
User
2026-02-01 03:52:59 +01:00
parent ea0ee0c190
commit 46b7b01e98

View File

@@ -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 = ?")