aboutsummaryrefslogtreecommitdiffstats
path: root/app/workers
diff options
context:
space:
mode:
authorTeddy Wing2018-03-13 18:08:16 +0100
committerTeddy Wing2018-03-14 16:42:02 +0100
commit3fe9aad1d003814c2f5a5de834ce42a028df1753 (patch)
tree2940e5cc76e3b0069895e3406f52b5f5a3751d8f /app/workers
parent1ce665267da0e303661e28b8f228ccac3823fa36 (diff)
downloadchouette-core-3fe9aad1d003814c2f5a5de834ce42a028df1753.tar.bz2
RouteWayCostWorker: Switch to referential in order to find Route
Just running `Chouette::Route.find(id)` doesn't give us anything if we don't have a `Referential` selected. In order to properly get the correct route, pass the referential ID to the worker and switch to that referential before trying to select the route. Refs #6095
Diffstat (limited to 'app/workers')
-rw-r--r--app/workers/route_way_cost_worker.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/workers/route_way_cost_worker.rb b/app/workers/route_way_cost_worker.rb
index adb10957b..fa5bd737d 100644
--- a/app/workers/route_way_cost_worker.rb
+++ b/app/workers/route_way_cost_worker.rb
@@ -1,7 +1,8 @@
class RouteWayCostWorker
include Sidekiq::Worker
- def perform(route_id)
+ def perform(referential_id, route_id)
+ Referential.find(referential_id).switch
route = Chouette::Route.find(route_id)
RouteWayCostCalculator.new(route).calculate!
end