openplans/OpenTripPlanner — pull request #1109 by JordenVerwer (2013-06-14 15:15:53+00:00)
Title: Fix the computation of the end time of the last leg

While I was working on implementing the bike switching penalty feature, I noticed that the duration of the individual legs would not always add up to the total duration of the entire itinerary, sometimes causing the penalty to disappear from view.

It turns out that the end time of the last leg isn't computed correctly. The end time of the back state is used, instead of the end time of the current state. It appears that this behavior is correct for the rest of the legs, just not the last one. I've added a test to prove that OTP currently doesn't generate the last leg correctly and implemented a possible fix, without claiming that this is the best fix imaginable.

I also believe that the code that generates the names of individual legs may be incorrect, but I didn't look into this in detail, because it's not a critical issue in my opinion. If desired, we can discuss this at a later time.