diff --git a/server/device.py b/server/device.py index 0a2dce28..acd7e2e7 100755 --- a/server/device.py +++ b/server/device.py @@ -376,11 +376,15 @@ def update_devices_data_from_scan (db): FROM CurrentScan WHERE Devices.devMac = CurrentScan.cur_MAC ) - WHERE EXISTS ( - SELECT 1 - FROM CurrentScan - WHERE Devices.devMac = CurrentScan.cur_MAC - AND CurrentScan.cur_NetworkNodeMAC IS NOT NULL AND CurrentScan.cur_NetworkNodeMAC NOT IN ("", "null") + WHERE + (devParentMAC IS NULL OR devParentMAC IN ("", "null", "(unknown)", "(Unknown)")) + AND + EXISTS ( + SELECT 1 + FROM CurrentScan + WHERE Devices.devMac = CurrentScan.cur_MAC + AND CurrentScan.cur_NetworkNodeMAC IS NOT NULL AND CurrentScan.cur_NetworkNodeMAC NOT IN ("", "null") + )""") # Update only devices with empty or NULL devSite diff --git a/server/networkscan.py b/server/networkscan.py index 6ed3aa8d..0429d62a 100755 --- a/server/networkscan.py +++ b/server/networkscan.py @@ -66,7 +66,7 @@ def process_scan (db): # Clear current scan as processed # 🐛 CurrentScan DEBUG: comment out below when debugging to keep the CurrentScan table after restarts/scan finishes - db.sql.execute ("DELETE FROM CurrentScan") + # db.sql.execute ("DELETE FROM CurrentScan") # Commit changes db.commitDB()