From b05ab63f2820c3243832d2b98cdbbba17fd1839f Mon Sep 17 00:00:00 2001 From: Victor Goncharov Date: Wed, 4 Jun 2025 00:09:23 +0200 Subject: [PATCH] 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. --- app/helpers/application_helper.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 47d40698..329b731d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -169,9 +169,9 @@ module ApplicationHelper end def point_speed(speed) - return speed if speed.to_i <= 0 - - speed * 3.6 + return "–" if speed.nil? || speed.to_f <= 0 + speed = speed.to_f + "#{(speed * 3.6).round(1)}" end def days_left(active_until)