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:
@@ -929,18 +929,19 @@ class DeviceDatabase:
|
|||||||
since: ISO timestamp. If None, returns all devices with sync-relevant data.
|
since: ISO timestamp. If None, returns all devices with sync-relevant data.
|
||||||
|
|
||||||
Returns:
|
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()
|
conn = self._get_connection()
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
|
|
||||||
|
# Don't sync position offsets - they're relative to each scanner's location
|
||||||
query = """
|
query = """
|
||||||
SELECT device_id, device_type, name, ssid, manufacturer,
|
SELECT device_id, device_type, name, ssid, manufacturer,
|
||||||
custom_label, assigned_floor, custom_lat_offset, custom_lon_offset,
|
custom_label, assigned_floor, is_favorite, notes, updated_at
|
||||||
is_favorite, notes, updated_at
|
|
||||||
FROM devices
|
FROM devices
|
||||||
WHERE (custom_label IS NOT NULL OR assigned_floor IS NOT NULL
|
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 = []
|
params = []
|
||||||
|
|
||||||
@@ -1001,13 +1002,7 @@ class DeviceDatabase:
|
|||||||
updates.append("assigned_floor = ?")
|
updates.append("assigned_floor = ?")
|
||||||
params.append(dev["assigned_floor"])
|
params.append(dev["assigned_floor"])
|
||||||
|
|
||||||
if dev.get("custom_lat_offset") is not None:
|
# Note: position offsets are NOT synced - they're relative to each scanner
|
||||||
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"])
|
|
||||||
|
|
||||||
if dev.get("is_favorite") is not None:
|
if dev.get("is_favorite") is not None:
|
||||||
updates.append("is_favorite = ?")
|
updates.append("is_favorite = ?")
|
||||||
|
|||||||
Reference in New Issue
Block a user