aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/chouette/vehicle_journey.rb
diff options
context:
space:
mode:
authorZog2018-01-08 11:06:20 +0100
committerZog2018-01-11 21:55:48 +0100
commitef3942099583f86d3f355a1bac8d99ce16cd2de3 (patch)
tree0519d8d4d4495da9acc7d0e02e36a2f68028c527 /app/models/chouette/vehicle_journey.rb
parent1fd6d7d0cfb63b024860d1c29fca089432fce2e1 (diff)
downloadchouette-core-ef3942099583f86d3f355a1bac8d99ce16cd2de3.tar.bz2
Refs #5493 @1h; Use local time in the Journeys editor
We store UTC times in the database though
Diffstat (limited to 'app/models/chouette/vehicle_journey.rb')
-rw-r--r--app/models/chouette/vehicle_journey.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/chouette/vehicle_journey.rb b/app/models/chouette/vehicle_journey.rb
index 1904e1b92..67216e422 100644
--- a/app/models/chouette/vehicle_journey.rb
+++ b/app/models/chouette/vehicle_journey.rb
@@ -132,10 +132,14 @@ module Chouette
def update_vjas_from_state state
state.each do |vjas|
next if vjas["dummy"]
+ stop_point = Chouette::StopPoint.find_by(objectid: vjas['stop_point_objectid'])
+ stop_area = stop_point&.stop_area
+ tz = stop_area&.time_zone
+ tz = tz && ActiveSupport::TimeZone[tz]
params = {}.tap do |el|
['arrival_time', 'departure_time'].each do |field|
time = "#{vjas[field]['hour']}:#{vjas[field]['minute']}"
- el[field.to_sym] = Time.parse("2000-01-01 #{time}:00 UTC")
+ el[field.to_sym] = Time.parse("2000-01-01 #{time}:00 #{tz&.formatted_offset || "UTC"}")
end
end
stop = create_or_find_vjas_from_state(vjas)