~ihabunek/triglav

61902f4b1a74a3ca7a25c206a57f448de024ba37 — Ivan Habunek a month ago f35d143
Sort relation members in validated data

I could swear this worked before...
1 files changed, 2 insertions(+), 0 deletions(-)

M lib/triglav/derived/public_transport.ex
M lib/triglav/derived/public_transport.ex => lib/triglav/derived/public_transport.ex +2 -0
@@ 141,6 141,7 @@ defmodule Triglav.Derived.PublicTransport do
  defp trip_stop_ids(relation, platform_member_map) do
    relation.members
    |> Enum.filter(&String.starts_with?(&1.member_role, "platform"))
    |> Enum.sort_by(& &1.sequence_id)
    |> Enum.map(&Map.get(platform_member_map, {&1.relation_id, &1.sequence_id}))
    |> Enum.map(& &1.member.tags["gtfs:stop_id"])
  end


@@ 149,6 150,7 @@ defmodule Triglav.Derived.PublicTransport do
    ordered_ways =
      relation.members
      |> Enum.filter(&(&1.member_type == "W" and &1.member_role == ""))
      |> Enum.sort_by(& &1.sequence_id)
      |> Enum.map(fn member -> Map.fetch!(ways_map, member.member_id) end)

    case Router.route_ways(ordered_ways) do