Fix locations being sorted unlucky because legs are not filtered properly because of misspelled attributes
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user