mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-05 05:25:24 +02:00
Clean up TimeSeries::Trend
This commit is contained in:
parent
5d14d03963
commit
70747320c0
1 changed files with 3 additions and 5 deletions
|
@ -26,10 +26,8 @@ class TimeSeries::Trend
|
|||
end
|
||||
|
||||
def value
|
||||
if previous.nil? && current.is_a?(Money)
|
||||
Money.new 0
|
||||
elsif previous.nil?
|
||||
0
|
||||
if previous.nil?
|
||||
current.is_a?(Money) ? Money.new(0) : 0
|
||||
else
|
||||
current - previous
|
||||
end
|
||||
|
@ -38,7 +36,7 @@ class TimeSeries::Trend
|
|||
def percent
|
||||
if previous.nil?
|
||||
0.0
|
||||
elsif previous == 0
|
||||
elsif previous.zero?
|
||||
Float::INFINITY
|
||||
else
|
||||
change = (current_amount - previous_amount).abs
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue