Skip to content

Commit

Permalink
Merge pull request #29843 from Expensify/neil-waypoint-ordering
Browse files Browse the repository at this point in the history
Fix distance waypoint ordering
  • Loading branch information
grgia authored Oct 20, 2023
2 parents 9e1f190 + 6013550 commit 262c8d0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/libs/TransactionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,9 @@ function getWaypointIndex(key: string): number {
* Filters the waypoints which are valid and returns those
*/
function getValidWaypoints(waypoints: WaypointCollection, reArrangeIndexes = false): WaypointCollection {
const sortedIndexes = Object.keys(waypoints).map(getWaypointIndex).sort();
const sortedIndexes = Object.keys(waypoints)
.map(getWaypointIndex)
.sort((a, b) => a - b);
const waypointValues = sortedIndexes.map((index) => waypoints[`waypoint${index}`]);
// Ensure the number of waypoints is between 2 and 25
if (waypointValues.length < 2 || waypointValues.length > 25) {
Expand Down

0 comments on commit 262c8d0

Please sign in to comment.