Skip to content

Commit

Permalink
use short name for bus (#2152)
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyshull authored Aug 20, 2024
1 parent 3265e1b commit dd13a0b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/dotcom/trip_plan/itinerary_row.ex
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,20 @@ defmodule Dotcom.TripPlan.ItineraryRow do
def route_type(%__MODULE__{route: %Route{type: type}}), do: type
def route_type(_row), do: nil

@doc """
Returns the name of the route for the given row.
If there is an external agency name, we use the long name.
If it is a bus, we use the short name.
For all others, we use the long name.
"""
def route_name(%__MODULE__{route: %Route{external_agency_name: agency, long_name: long_name}})
when is_binary(agency) and is_binary(long_name),
do: long_name

def route_name(%__MODULE__{route: %Route{name: name, type: 3}})
when is_binary(name),
do: "#{name} bus"

def route_name(%__MODULE__{route: %Route{long_name: long_name}})
when is_binary(long_name),
do: long_name
Expand Down

0 comments on commit dd13a0b

Please sign in to comment.