aboutsummaryrefslogtreecommitdiffstats
path: root/app/views
diff options
context:
space:
mode:
authorXinhui2017-03-01 12:03:26 +0100
committerXinhui2017-03-01 12:04:46 +0100
commite937897aaecf2f4c4e8db63d37b5e515eba2a048 (patch)
treedeffdf8e8e7b7b9832f6e27749aaa2437161d4c4 /app/views
parent599addc323b0b08ddcea7871748760c0bec83585 (diff)
downloadchouette-core-e937897aaecf2f4c4e8db63d37b5e515eba2a048.tar.bz2
Wip dummy vehicle_journey_at_stops in json
Diffstat (limited to 'app/views')
-rw-r--r--app/views/vehicle_journeys/show.rabl16
1 files changed, 11 insertions, 5 deletions
diff --git a/app/views/vehicle_journeys/show.rabl b/app/views/vehicle_journeys/show.rabl
index fc650784c..209b8371d 100644
--- a/app/views/vehicle_journeys/show.rabl
+++ b/app/views/vehicle_journeys/show.rabl
@@ -1,7 +1,7 @@
object @vehicle_journey
[ :objectid, :published_journey_name, :published_journey_identifier, :company_id].each do |attr|
- attributes attr, :unless => lambda { |m| m.send( attr)}
+ attributes attr, :unless => lambda { |m| m.send( attr).nil?}
end
child(:journey_pattern) do |journey_pattern|
@@ -19,12 +19,18 @@ child :footnotes, :object_root => false do |footnotes|
attributes :id, :code, :label
end
-child :vehicle_journey_at_stops, :object_root => false do |vehicle_stops|
+child(:vehicle_journey_at_stops_matrix, :object_root => false) do |vehicle_stops|
node do |vehicle_stop|
- node(:stop_area_object_id) { vehicle_stop.stop_point.stop_area.objectid }
- node(:stop_area_name) {vehicle_stop.stop_point.stop_area.name}
+ node(:dummy) { !vehicle_stop.stop_point_id? }
+ node(:stop_area_object_id) do
+ vehicle_stop.stop_point ? vehicle_stop.stop_point.stop_area.objectid : nil
+ end
+ node(:stop_area_name) do
+ vehicle_stop.stop_point ? vehicle_stop.stop_point.stop_area.name : nil
+ end
+
[:id, :connecting_service_id, :boarding_alighting_possibility].map do |att|
- node(att) { vehicle_stop.send(att) } unless vehicle_stop.send(att).nil?
+ node(att) { vehicle_stop.send(att) ? vehicle_stop.send(att) : nil }
end
[:arrival_time, :departure_time].map do |att|