aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXinhui2017-02-15 15:49:16 +0100
committerXinhui2017-02-15 16:05:56 +0100
commit486562907aa7f2daaf12c5ec2a7fe118c8b2e2f8 (patch)
tree96367b27876cb3d1fb72aaa6c5b231e017daf05b
parentb237c0947d65607b1fe03ead136dd952db1b8d63 (diff)
downloadchouette-core-486562907aa7f2daaf12c5ec2a7fe118c8b2e2f8.tar.bz2
Wip date format vehicle_journey_at_stops
-rw-r--r--app/views/vehicle_journeys/show.rabl15
1 files changed, 7 insertions, 8 deletions
diff --git a/app/views/vehicle_journeys/show.rabl b/app/views/vehicle_journeys/show.rabl
index d6df84204..7ea226916 100644
--- a/app/views/vehicle_journeys/show.rabl
+++ b/app/views/vehicle_journeys/show.rabl
@@ -34,14 +34,13 @@ end
child :vehicle_journey_at_stops, :object_root => false do |vehicle_stops|
node do |vehicle_stop|
node(:stop_area_object_id) { vehicle_stop.stop_point.stop_area.objectid }
- [ :connecting_service_id, :arrival_time, :departure_time, :boarding_alighting_possibility].each do |attr|
- node( attr) do
- if vehicle_stop.send(attr).is_a? Time
- vehicle_stop.send(attr).iso8601()
- else
- vehicle_stop.send(attr)
- end
- end unless vehicle_stop.send(attr).nil?
+ [:connecting_service_id, :boarding_alighting_possibility].map do |att|
+ node(att) { vehicle_stop.send(att) } unless vehicle_stop.send(att).nil?
+ end
+
+ [:arrival_time, :departure_time].map do |att|
+ node("#{att}_hour".to_sym) { vehicle_stop.send(att).strftime('%H') }
+ node("#{att}_minute".to_sym) { vehicle_stop.send(att).strftime('%M') }
end
end
end