diff options
| author | Zog | 2018-04-26 14:53:35 +0200 |
|---|---|---|
| committer | Zog | 2018-04-26 14:53:35 +0200 |
| commit | 138764710a09bc551b64c1f70dd345663cc39ffd (patch) | |
| tree | 940749218ca9d555aac0b529f74be5d118b46c04 /app/models/chouette/vehicle_journey.rb | |
| parent | e69dfa80737402286adbfe6f29edae2efca36fd8 (diff) | |
| download | chouette-core-138764710a09bc551b64c1f70dd345663cc39ffd.tar.bz2 | |
Refs #6826; Fix times interpolation with day offsets6826-fix-times-interpolation
Diffstat (limited to 'app/models/chouette/vehicle_journey.rb')
| -rw-r--r-- | app/models/chouette/vehicle_journey.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/models/chouette/vehicle_journey.rb b/app/models/chouette/vehicle_journey.rb index 8a29057e2..8b5354863 100644 --- a/app/models/chouette/vehicle_journey.rb +++ b/app/models/chouette/vehicle_journey.rb @@ -369,10 +369,15 @@ module Chouette if before_cost && before_cost[:distance] && after_cost && after_cost[:distance] before_distance = before_cost[:distance].to_f after_distance = after_cost[:distance].to_f - time = previous_stop.departure_time + before_distance / (before_distance+after_distance) * (vjas.arrival_time - previous_stop.departure_time) + arrival_time = vjas.arrival_time + (vjas.arrival_day_offset - previous_stop.departure_day_offset)*24.hours + time = previous_stop.departure_time + before_distance / (before_distance+after_distance) * (arrival_time - previous_stop.departure_time) + day_offset = time.day - 1 + time -= day_offset*24.hours encountered_borders.each do |b| b.update_attribute :arrival_time, time + b.update_attribute :arrival_day_offset, previous_stop.arrival_day_offset + day_offset b.update_attribute :departure_time, time + b.update_attribute :departure_day_offset, previous_stop.departure_day_offset + day_offset end end encountered_borders = [] |
