From 3221693f6f4a7b99db0f68beb46bb5d3626af86c Mon Sep 17 00:00:00 2001 From: Zog Date: Thu, 22 Feb 2018 09:57:27 +0100 Subject: Refs #5995; Add extra columns on ReferentialVJs#index when filtered by stops --- app/views/referential_vehicle_journeys/index.html.slim | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/views/referential_vehicle_journeys/index.html.slim b/app/views/referential_vehicle_journeys/index.html.slim index 04c01cc12..1adcfae36 100644 --- a/app/views/referential_vehicle_journeys/index.html.slim +++ b/app/views/referential_vehicle_journeys/index.html.slim @@ -40,14 +40,19 @@ TableBuilderHelper::Column.new( \ key: :departure_time, \ attribute: Proc.new {|v| v.vehicle_journey_at_stops.first&.departure }, \ - sortable: false, \ - name: @starting_stop&.name, \ + sortable: false \ ), \ + [@starting_stop, @ending_stop].compact.map{|stop| \ + TableBuilderHelper::Column.new( \ + attribute: Proc.new {|v| v.vehicle_journey_at_stops.where("stop_points.stop_area_id" => stop.id).last.arrival }, \ + sortable: false, \ + name: stop.name \ + )\ + }, \ TableBuilderHelper::Column.new( \ key: :arrival_time, \ attribute: Proc.new {|v| v.vehicle_journey_at_stops.last&.arrival }, \ sortable: false, \ - name: @ending_stop&.name, \ ), \ ].flatten.compact, cls: 'table has-filter has-search' -- cgit v1.2.3