diff options
| author | Alban Peignier | 2018-03-15 18:23:32 +0100 |
|---|---|---|
| committer | Luc Donnet | 2018-03-23 17:16:44 +0100 |
| commit | 5c78b1428380dbb9d9945ea66aabf749f32c4087 (patch) | |
| tree | 2647e25b607f74a9f108cd16516be840115c1c42 /lib | |
| parent | 8ff9c72521237f6f3ae5f2d7fc249da34137df6d (diff) | |
| download | chouette-core-5c78b1428380dbb9d9945ea66aabf749f32c4087.tar.bz2 | |
Avoid error when distance or time cost is ignored. Refs #6203
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/route_way_cost_unit_converter.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/route_way_cost_unit_converter.rb b/lib/route_way_cost_unit_converter.rb index 979e92b0c..45edbf538 100644 --- a/lib/route_way_cost_unit_converter.rb +++ b/lib/route_way_cost_unit_converter.rb @@ -12,10 +12,14 @@ class RouteWayCostUnitConverter # Round to 2 decimal places to appease JavaScript validation def self.meters_to_kilometers(num) - (num / 1000.0).round(2) + return 0 unless num + + (num / 1000.0).to_i end def self.seconds_to_minutes(num) + return 0 unless num + num / 60 end end |
