hove-io / navitia

The open source software to build cool stuff with locomotion
https://www.navitia.io/
GNU Affero General Public License v3.0
434 stars 126 forks source link

DST offset interferes with block-transfers #819

Closed koch-t closed 9 years ago

koch-t commented 9 years ago
19:32 < skywavenl> Question:
19:32 < skywavenl> https://github.com/CanalTP/navitia/blob/a64fff0548091ab5257239342d2302275797e828/source/ed/data.cpp#L72
19:32 < skywavenl> Is stop_times_list actually sorted?
19:32 < skywavenl> I'm trying to figure out why it links the wrong journeys
20:53 < skywavenl> Figured it out
20:53 < skywavenl> It's the DST offset interfering with it
20:54 < skywavenl> I got a hack-fix not i'm note sure if there is a better solution which allows a blocktransfer across the DST change.

After the UTC shifting, multiple trips are no longer sorted rightly ordered within the block, thus navitia makes transfers across timezones. Quick hackfix: but i think there are better solutions, possible by also checking whether the validitypattern overlaps before setting the block-transfers

diff --git a/source/ed/data.cpp b/source/ed/data.cpp
index eb2191a..b4dfe29 100644
--- a/source/ed/data.cpp
+++ b/source/ed/data.cpp
@@ -73,6 +73,8 @@ void Data::build_block_id() {
             [](const types::VehicleJourney* vj1, const types::VehicleJourney* vj2) {
             if(vj1->block_id != vj2->block_id) {
                 return vj1->block_id < vj2->block_id;
+            }else if (vj1->utc_to_local_offset != vj2->utc_to_local_offset){
+                return vj1->utc_to_local_offset < vj2->utc_to_local_offset;
             } else {
                 return vj1->stop_time_list.back()->arrival_time <=
                         vj2->stop_time_list.front()->departure_time;
antoine-de commented 9 years ago

thanks for the find!

I think the check on the validity pattern is a bit better, I'll fix that on monday.