diff options
| author | Teddy Wing | 2017-05-24 11:41:22 +0200 |
|---|---|---|
| committer | Teddy Wing | 2017-05-26 13:20:55 +0200 |
| commit | fdd66e2298eda51f67b587bb677591925ee5b859 (patch) | |
| tree | 9304d983e2204a250e5c1b99b40d30d7445af91b | |
| parent | 16c9f2b445de2af540db4280bde39666101e1eb0 (diff) | |
| download | chouette-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
| -rw-r--r-- | app/models/chouette/vehicle_journey_at_stops_are_in_increasing_time_order_validator.rb | 12 |
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 |
