fixes for ammount changer

This commit is contained in:
Adrian Hinz 2022-05-05 14:54:34 +02:00
parent c3b3419754
commit 2f1347a340
2 changed files with 10 additions and 10 deletions

View File

@ -3,21 +3,21 @@
# helper for home # helper for home
module HomeHelper module HomeHelper
def change_ammount(ammount) def change_ammount(ammount)
return '' if ammount.blank? HomeHelper.change_ammount(ammount)
ret = if ammount >= 1_000_000
"#{ammount / 1_000_000} mln"
else
"#{ammount / 1_000} tys."
end
ret
end end
def self.change_ammount(ammount) def self.change_ammount(ammount)
return '' if ammount.blank? return '' if ammount.blank?
ret = if ammount >= 1_000_000 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 else
"#{ammount / 1_000} tys." "#{ammount / 1_000} tys."
end end

View File

@ -132,7 +132,7 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<%= render '/partners/partner_show', partner: @dotation.partner %> <%= render '/partners/partner_show', partner: @dotation.partner, div_id: 'test' %>
</div> </div>
</div> </div>
<div class="row"> <div class="row">