Fix locations being sorted unlucky because legs are not filtered properly because of misspelled attributes

This commit is contained in:
2025-07-07 16:35:07 +02:00
parent 3b14fa6c51
commit e3a4f87fe4

View File

@@ -181,7 +181,7 @@ export function sortLocations(sorted_locations, unsorted_locations, legs) {
let selected_location_id = getLocationWithLeastInboundTrips(unsorted_locations, legs); let selected_location_id = getLocationWithLeastInboundTrips(unsorted_locations, legs);
unsorted_locations = unsorted_locations.filter(location_id => location_id != selected_location_id); unsorted_locations = unsorted_locations.filter(location_id => location_id != selected_location_id);
legs = legs.filter(leg => leg.destination_id != selected_location_id && leg.origin_id != selected_location_id); legs = legs.filter(leg => leg.destination_location_id != selected_location_id && leg.origin_location_id != selected_location_id);
return sortLocations(sorted_locations.concat([ selected_location_id ]), unsorted_locations, legs); return sortLocations(sorted_locations.concat([ selected_location_id ]), unsorted_locations, legs);
} }