Skip to content

Commit

Permalink
fixup: one tag per itinerary
Browse files Browse the repository at this point in the history
  • Loading branch information
thecristen committed Feb 14, 2024
1 parent c0b311b commit b66ef82
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions lib/dotcom_web/views/trip_plan_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -519,19 +519,22 @@ defmodule DotcomWeb.TripPlanView do
tab_html: tab_html,
id: index,
map: itinerary_map(map),
tags:
Enum.map(i.tags, fn tag ->
tag
|> Atom.to_string()
|> String.replace("_", " ")
end),
tag: tag_string(i.tag),
access_html: access_html,
fares_estimate_html: fares_estimate_html,
fare_calculator_html: fare_calculator_html
}
end
end

defp tag_string(nil), do: nil

defp tag_string(tag),
do:
tag
|> Atom.to_string()
|> String.replace("_", " ")

@spec render_react(map) :: HTML.safe()
def render_react(assigns) do
Util.log_duration(__MODULE__, :do_render_react, [assigns])
Expand Down
2 changes: 1 addition & 1 deletion lib/trip_plan/api/open_trip_planner.ex
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ defmodule TripPlan.Api.OpenTripPlanner do
stop: parse_time(json["endTime"]),
legs: Enum.map(json["legs"], &parse_leg/1),
accessible?: if(score, do: score == 1.0),
tag: json["tag"] |> MapSet.to_list()
tag: json["tag"]
}
end

Expand Down

0 comments on commit b66ef82

Please sign in to comment.