Update system.py

This commit is contained in:
SpudGunMan
2024-08-10 09:58:30 -07:00
parent 1e921dd5ea
commit 9e205155a5
+3 -2
View File
@@ -322,8 +322,9 @@ def get_closest_nodes(nodeInt=1,returnCount=3):
# except Exception as e:
# logger.error(f"System: Error requesting location data for {node['id']}. Error: {e}")
#sort by distance closest to lattitudeValue, longitudeValue
node_list.sort(key=lambda x: (x['latitude']-latitudeValue)**2 + (x['longitude']-longitudeValue)**2)
# sort by distance closest
#node_list.sort(key=lambda x: (x['latitude']-latitudeValue)**2 + (x['longitude']-longitudeValue)**2)
node_list.sort(key=lambda x: x['distance'])
# return the first 3 closest nodes by default
return node_list[:returnCount]
else: