finally make negative work the drunk way
This commit is contained in:
parent
f940d30c19
commit
9d892d0228
1 changed files with 7 additions and 6 deletions
13
app.rb
13
app.rb
|
@ -67,18 +67,19 @@ def players
|
|||
end
|
||||
|
||||
def readable_number(value)
|
||||
#negative = false
|
||||
negative = false
|
||||
|
||||
#negative = true if value.to_f < 0
|
||||
#value = value * -1 if value < 0
|
||||
negative = true if value.to_f < 0
|
||||
value *= -1 if value < 0
|
||||
numbers.each do |number, symbol|
|
||||
if value.to_f / number.to_f > 1
|
||||
return sprintf('%.2f', value.to_f / number.to_f) + '<strong>' + symbol + '</strong>'
|
||||
new_value = '-' if negative
|
||||
new_value += sprintf('%.2f', value.to_f / number.to_f) + '<strong>' + symbol + '</strong>'
|
||||
return new_value
|
||||
end
|
||||
end
|
||||
|
||||
#value = 0.0 unless value
|
||||
#value = value * -1 if negative
|
||||
value = 0.0 unless value
|
||||
return sprintf('%.2f', value) + "_"
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue