diff options
| author | Bruno Perles | 2015-12-15 11:53:25 +0100 |
|---|---|---|
| committer | Bruno Perles | 2015-12-16 10:13:33 +0100 |
| commit | f41006a744f400bafc5c5e1d6eda6dcfe82e50ae (patch) | |
| tree | ed630f0ae6858fcc4e13f482221a50af0cfeab14 | |
| parent | 7dcacdaeb2d8bc747bd5814d453a21d8e6eb4838 (diff) | |
| download | chouette-core-f41006a744f400bafc5c5e1d6eda6dcfe82e50ae.tar.bz2 | |
update bug on edit route_section
| -rw-r--r-- | app/models/route_sections_selector.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/models/route_sections_selector.rb b/app/models/route_sections_selector.rb index 432d12d8f..b3c984559 100644 --- a/app/models/route_sections_selector.rb +++ b/app/models/route_sections_selector.rb @@ -31,7 +31,13 @@ class RouteSectionsSelector [].tap do |sections| stop_points.each_cons(2).each_with_index do |(departure, arrival), index| journey_pattern_section = Chouette::JourneyPatternSection.find_by(journey_pattern: @itinerary, rank: index) - route_section = journey_pattern_section ? journey_pattern_section.route_section : nil + + if journey_pattern_section + route_section = journey_pattern_section ? journey_pattern_section.route_section : nil + else + route_section = Chouette::RouteSection.find_by(departure: departure.stop_area, arrival: arrival.stop_area) + end + sections << Section.new(departure.stop_area, arrival.stop_area, route_section) end end |
