aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/chouette/route.rb
diff options
context:
space:
mode:
authorTeddy Wing2018-03-13 15:37:55 +0100
committerTeddy Wing2018-03-14 16:42:02 +0100
commitdbcd099b3d38f7c584450edffc8bee0a2502b170 (patch)
tree0ddcd221974db03e957e6621a5f4b050833ffc87 /app/models/chouette/route.rb
parent012363fca2bbe2d75145e8ca3b85f8fcb48ad164 (diff)
downloadchouette-core-dbcd099b3d38f7c584450edffc8bee0a2502b170.tar.bz2
Route: Add `#calculate_costs!` to populate `#costs` with `WayCost`s
This new method will launch a worker that takes the route's `StopArea`s, converts them to `WayCost`s, sends them to the TomTom API to calculate distance and time costs, and saves those costs to the route's `costs` field. Refs #6095
Diffstat (limited to 'app/models/chouette/route.rb')
-rw-r--r--app/models/chouette/route.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/chouette/route.rb b/app/models/chouette/route.rb
index d0d776bc6..a1d44f53f 100644
--- a/app/models/chouette/route.rb
+++ b/app/models/chouette/route.rb
@@ -188,6 +188,10 @@ module Chouette
journey_pattern
end
+ def calculate_costs!
+ RouteWayCostWorker.perform_async(id)
+ end
+
protected
def self.vehicle_journeys_timeless(stop_point_id)