diff --git a/app/helpers/home_helper.rb b/app/helpers/home_helper.rb index 51397e0..b0f5cbe 100644 --- a/app/helpers/home_helper.rb +++ b/app/helpers/home_helper.rb @@ -3,21 +3,21 @@ # helper for home module HomeHelper def change_ammount(ammount) - return '' if ammount.blank? - - ret = if ammount >= 1_000_000 - "#{ammount / 1_000_000} mln" - else - "#{ammount / 1_000} tys." - end - ret + HomeHelper.change_ammount(ammount) end def self.change_ammount(ammount) return '' if ammount.blank? ret = if ammount >= 1_000_000 - "#{ammount / 1_000_000} mln" + amm = ammount / 1_000_000 + rest = (ammount % 1_000_000) / 1_000 + re1 = if rest.zero? + amm + else + "#{amm}.#{rest}".to_f.to_s.tr('.', ',') + end + "#{re1} mln" else "#{ammount / 1_000} tys." end diff --git a/app/views/grants/_show.html.erb b/app/views/grants/_show.html.erb index eb3002c..fdb99fd 100644 --- a/app/views/grants/_show.html.erb +++ b/app/views/grants/_show.html.erb @@ -132,7 +132,7 @@