diff options
| author | Teddy Wing | 2018-03-13 15:37:55 +0100 | 
|---|---|---|
| committer | Teddy Wing | 2018-03-14 16:42:02 +0100 | 
| commit | dbcd099b3d38f7c584450edffc8bee0a2502b170 (patch) | |
| tree | 0ddcd221974db03e957e6621a5f4b050833ffc87 /app/workers | |
| parent | 012363fca2bbe2d75145e8ca3b85f8fcb48ad164 (diff) | |
| download | chouette-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/workers')
| -rw-r--r-- | app/workers/route_way_cost_worker.rb | 8 | 
1 files changed, 8 insertions, 0 deletions
| diff --git a/app/workers/route_way_cost_worker.rb b/app/workers/route_way_cost_worker.rb new file mode 100644 index 000000000..adb10957b --- /dev/null +++ b/app/workers/route_way_cost_worker.rb @@ -0,0 +1,8 @@ +class RouteWayCostWorker +  include Sidekiq::Worker + +  def perform(route_id) +    route = Chouette::Route.find(route_id) +    RouteWayCostCalculator.new(route).calculate! +  end +end | 
