Conversation
…les. Added support for boat names in predictions. Allowed ferrys to show real time predictions.
joshlarson
left a comment
There was a problem hiding this comment.
There are several issues that I'd love to see resolved:
- It should be
The Champion, notBoat Champion. - The test failures and 500 issues need to be resolved (fortunately, I'm pretty sure those have the same culprit).
- I'd like to see test coverage for this feature; ideally one test that asserts that the boat label is set correctly for ferry, and another that asserts that it's omitted for other modes. See below for a more precise suggestion.
- There's nothing preventing
boat_namefrom showing up for non-ferry departures. I tried doing a simple fix for thevehicle == nilissue, and saw the following:
I would recommend pushing all of the logic (including the string manipulation of "CHAMPION" ==> "The Champion") into the backend under trip_details.ex, probably adding a field called boat_label or boat_name to vehicle_info (and getting rid of vehicle_id). Then TripDetails.trip_details/1 can set that to whatever the boat name is for ferry, and leave it nil for all other modes, you can test those things in trip_details_test.exs, and the LiveView can be really stupid about it:
<div :if={vehicle_info.boat_name}>{vehicle_info.boat_name}</div>(I think I'm comfortable with strings like The Champion not being translated, though maybe that's a product/design question, because the whole thing is kind of a proper noun... I would expect to see a ship called El Campeón in Spain, not The Campeón, for instance, even if I was reading the page in English.)
Added function to include boat names on ferries
…doesn't work here. Added a join to put it back together.
…thanks Cristen for the help!
joshlarson
left a comment
There was a problem hiding this comment.
This looks great and works great, as far as I can tell!
I left a whole host of code-style comments. My hunch is that most of them (probably all but the vehicle_info/add_vehicle_name one) will be fairly straightforward (and hopefully uncontroversial) to apply before merging, but for any that are either nontrivial or controversial, I don't think it's necessary to block this feature on them.
Changed accepted, thanks! Co-authored-by: Josh Larson <jlarson@mbta.com>
Co-authored-by: Josh Larson <jlarson@mbta.com>
Co-authored-by: Josh Larson <jlarson@mbta.com>
Scope
Asana Ticket: ⛴️ Turn on ferry realtime in SF 2.0
Implementation
Added vehicle_id to vehicle info of trip details in predicted schedules. Added support for boat names in SF 2.0 predictions. Allowed real time predictions to show up on SF 2.0 for ferries.
Screenshots
Ferry predictions with boat names





Other predictions without vehicle names
How to test
Find predictions in the API:
https://api-dev-green.mbtace.com/predictions?filter[route]=Boat-F1
https://api-dev-green.mbtace.com/predictions?filter[route]=Boat-F2H
See them on SF2.0
http://localhost:4001/preview/schedules/Boat-F1/0?stop=Boat-Long
http://localhost:4001/preview/schedules/Boat-F2H/0?stop=Boat-Long