Finally fix negative to work with positive
This commit is contained in:
parent
65c8c701f0
commit
1dc14ac245
1 changed files with 9 additions and 9 deletions
18
app.rb
18
app.rb
|
@ -67,17 +67,17 @@ def players
|
||||||
end
|
end
|
||||||
|
|
||||||
def readable_number(value)
|
def readable_number(value)
|
||||||
#if value.to_f < 0
|
if value.to_f < 0
|
||||||
# negative = true
|
negative = true
|
||||||
# value *= -1 if value < 0
|
value *= -1 if value < 0
|
||||||
#else
|
else
|
||||||
# negative = false
|
negative = false
|
||||||
#end
|
end
|
||||||
|
|
||||||
numbers.each do |number, symbol|
|
numbers.each do |number, symbol|
|
||||||
if value.to_f / number.to_f > 1
|
if value.to_f / number.to_f >= 1
|
||||||
#new_value = '-' if negative
|
new_value = negative ? '-' : ''
|
||||||
new_value = sprintf('%.2f', value.to_f / number.to_f) + '<strong>' + symbol + '</strong>'
|
new_value += sprintf('%.2f', value.to_f / number.to_f) + '<strong>' + symbol + '</strong>'
|
||||||
return new_value
|
return new_value
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue