aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorTeddy Wing2017-05-24 11:41:22 +0200
committerTeddy Wing2017-05-26 13:20:55 +0200
commitfdd66e2298eda51f67b587bb677591925ee5b859 (patch)
tree9304d983e2204a250e5c1b99b40d30d7445af91b /app
parent16c9f2b445de2af540db4280bde39666101e1eb0 (diff)
downloadchouette-core-fdd66e2298eda51f67b587bb677591925ee5b859.tar.bz2
IncreasingTimeOrderValidator: Rename `result` to `valid`
Make it more obvious what the return value is. Also add some extra whitespace. Refs #870
Diffstat (limited to 'app')
-rw-r--r--app/models/chouette/vehicle_journey_at_stops_are_in_increasing_time_order_validator.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/app/models/chouette/vehicle_journey_at_stops_are_in_increasing_time_order_validator.rb b/app/models/chouette/vehicle_journey_at_stops_are_in_increasing_time_order_validator.rb
index cc32ae520..a08ca42ea 100644
--- a/app/models/chouette/vehicle_journey_at_stops_are_in_increasing_time_order_validator.rb
+++ b/app/models/chouette/vehicle_journey_at_stops_are_in_increasing_time_order_validator.rb
@@ -24,18 +24,20 @@ module Chouette
end
def self.increasing_times_validate(at_stop, previous_at_stop)
- result = true
- return result unless previous_at_stop
+ valid = true
+ return valid unless previous_at_stop
if self.exceeds_gap?(previous_at_stop.departure_time, at_stop.departure_time)
- result = false
+ valid = false
at_stop.errors.add(:departure_time, 'departure time gap overflow')
end
+
if self.exceeds_gap?(previous_at_stop.arrival_time, at_stop.arrival_time)
- result = false
+ valid = false
at_stop.errors.add(:arrival_time, 'arrival time gap overflow')
end
- result
+
+ valid
end
# TODO: Get rid of this and change to TimeDuration version