Skip to content

Ordering of origins is reversed #6

@rvignesh89

Description

@rvignesh89

For my use case I need to create Map based on the response from Google Distance Matrix like below,

%{%{origin=>{lat,long},dest=>{lat,long}}=> {duration,distance}}
Since the response from the API converts coordinates into location I can't use the array returned by them to know which element corresponds to which source and destination. So I'm using the order in which I send the information to determine mapping of the results.

However because of how TravelList is constructed this list gets reversed. I feel this is a subtle but important change.

def add_entry(travel_list, travel = %{origin: origin, destination: destination}) do
    List.insert_at(travel_list, -1, travel)
  end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions