Skip to content

Commit b05ab63

Browse files
authored
Update application_helper.rb
Fixed `point_speed` in `application_helper.rb` to properly convert velocity from m/s to km/h, round to 1 decimal, and safely handle nil or zero values.
1 parent 396b900 commit b05ab63

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

app/helpers/application_helper.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,9 @@ def speed_text_color(speed)
169169
end
170170

171171
def point_speed(speed)
172-
return speed if speed.to_i <= 0
173-
174-
speed * 3.6
172+
return "–" if speed.nil? || speed.to_f <= 0
173+
speed = speed.to_f
174+
"#{(speed * 3.6).round(1)}"
175175
end
176176

177177
def days_left(active_until)

0 commit comments

Comments
 (0)