aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorTeddy Wing2017-05-04 17:18:05 +0200
committerTeddy Wing2017-05-04 17:18:05 +0200
commit76abc55ed7aeb07cf65ed2a027ad2cdc694c5751 (patch)
tree239f14f1c9fe1dd52307de0056e7c85649deda51 /app
parent32bc450f332b457ce7aca208a332876672df1bc1 (diff)
downloadchouette-core-76abc55ed7aeb07cf65ed2a027ad2cdc694c5751.tar.bz2
VehicleJourneysCtl#collection: Use VehicleJourney.with_stops
Use the class method to get the vehicle journeys in the proper order of departure time ascending. The `.with_stops` method replicates this same SQL sequence of joins and order. Refs #3268
Diffstat (limited to 'app')
-rw-r--r--app/controllers/vehicle_journeys_controller.rb10
1 files changed, 1 insertions, 9 deletions
diff --git a/app/controllers/vehicle_journeys_controller.rb b/app/controllers/vehicle_journeys_controller.rb
index f692f3628..316652ca2 100644
--- a/app/controllers/vehicle_journeys_controller.rb
+++ b/app/controllers/vehicle_journeys_controller.rb
@@ -77,15 +77,7 @@ class VehicleJourneysController < ChouetteController
protected
def collection
- scope = route.vehicle_journeys
- .joins(:journey_pattern)
- .joins('
- LEFT JOIN "vehicle_journey_at_stops"
- ON "vehicle_journey_at_stops"."vehicle_journey_id" = "vehicle_journeys"."id"
- AND "vehicle_journey_at_stops"."stop_point_id" =
- "journey_patterns"."departure_stop_point_id"
- ')
- .order("vehicle_journey_at_stops.departure_time")
+ scope = route.vehicle_journeys.with_stops
@q = scope.search filtered_ransack_params
grouping = ransack_periode_filter