From 9e205155a50acdfd0b38c3a61dfc64c63c6ad98e Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Sat, 10 Aug 2024 09:58:30 -0700 Subject: [PATCH] Update system.py --- modules/system.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/system.py b/modules/system.py index 4a4981a..c610df8 100644 --- a/modules/system.py +++ b/modules/system.py @@ -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: