~ihabunek/triglav

0d810ed3f097c611840f7ded5d949562fbcd405c — Ivan Habunek 3 months ago 679690a
Simplify naming
M lib/triglav_web/controllers/zet/routes_controller.ex => lib/triglav_web/controllers/zet/routes_controller.ex +4 -4
@@ 57,14 57,14 @@ defmodule TriglavWeb.Zet.RoutesController do
    relation_errors = Enum.filter(errors, & &1.relation_id) |> Enum.group_by(& &1.relation_id)
    route_errors = Enum.filter(errors, &is_nil(&1.relation_id))

    derived_trips = PublicTransport.list_route_trips(id)
    trips = PublicTransport.list_route_trips(id)
    zet_stops = Gtfs.fetch_distinct_stops(route)
    zet_stops_map = Map.new(zet_stops, &{&1.id, &1})

    zet_trips =
      Gtfs.list_distinct_trips(route_id: route.id)
      |> Enum.map(fn trip ->
        matched_trip = Enum.find(derived_trips, &(&1.sample_trip_id == trip.sample_trip_id))
        matched_trip = Enum.find(trips, &(&1.sample_trip_id == trip.sample_trip_id))
        matched_relation = if matched_trip, do: matched_trip.relation
        stops = Enum.map(trip.stop_ids, &Map.fetch!(zet_stops_map, &1))



@@ 74,12 74,12 @@ defmodule TriglavWeb.Zet.RoutesController do
      end)
      |> Enum.group_by(& &1.direction_id)

    trips_geojson = trips_feature_collecton(derived_trips) |> Jason.encode!()
    trips_geojson = trips_feature_collecton(trips) |> Jason.encode!()
    zet_stops_geojson = zet_stops_feature_collection(zet_stops) |> Jason.encode!()

    render(conn, "detail.html",
      conn: conn,
      derived_trips: derived_trips,
      trips: trips,
      hierarchy: hierarchy,
      relation_errors: relation_errors,
      relations: relations,

M lib/triglav_web/templates/zet/routes/detail.html.eex => lib/triglav_web/templates/zet/routes/detail.html.eex +1 -1
@@ 68,7 68,7 @@
  <% end %>

  <section>
    <%= for trip <- @derived_trips do %>
    <%= for trip <- @trips do %>
      <h3 style="margin-top: 1rem"><%= osm_link(trip.relation, name: true) %></h3>
      <div style="margin-left: 1rem;">
        <%= if length(trip.platforms) > 0 do %>