Closed elliottwilliams closed 8 years ago
I like this idea, and it solves a lot of questions I was having with implementation. To address each point:
activate
event from a route, Conductor can create the associations on each station, and vice versa on deactivate
. Since associated objects are kept in a Set
, there won't be any duplicates.update
event from a vehicle, Conductor finds the route that the vehicle is currently on, associates the vehicle to that route, and then sends a vehicle_update
event to it.depart
event would be nice, since it provides an event hook for when a vehicle leaves a station, which could be useful for notifying users that they missed their bus or something. In other words, I've already implemented it, so I might as well keep it.This should be closed by bfd566f0c4ee1c9ed1bca9893b332c8b16fdc70b.
Unless I'm mistaken, right now a station will only show that it has a vehicle approaching if that vehicle is no more than 3 stops away. This is probably fine for frequent, short loops (e.g. Silver Loop), but I think it poses some problems on larger, more infrequent routes.
Scenario: I'm trying to take the 1B from Cary to Greyhouse (true story). I select the "Stadium & Russell" stop. Currently, there is a 1B arriving in 8 minutes that is 5 stops away, and another arriving in 38 minutes that is 25 stops away. Neither would be shown and I would be left to assume that 1B doesn't come here.
So, here's a proposal:
activate
anddeactivate
events, and updating internal representation of stations as routes are activated on them.vehicle_update
event on the route's topic and updating anassociated_vehicles
property or similar.last_event
on station's id to get the data needed to show the view.meta.last_event
on each vehicle on routes that serve the station to get a vehicle's data before its next heartbeat.approach
anddepart
are superfluous, but we still care aboutdeactivate
.If this were implemented, I think vehicle-on-station events could be removed.