Skip to content

Commit

Permalink
fix error in balance chart
Browse files Browse the repository at this point in the history
  • Loading branch information
ishmael committed Dec 15, 2010
1 parent 53491a6 commit bff2ee7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/views/charts/_balance_by_year.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ categories = Array.new
account_currency = account[0].currency
previous_month = nil
if not account[0].starting_balance.nil?
previous_month = Money.new( account[0].starting_balance.to_i,account[0].currency)
previous_month = Money.new( account[0].starting_balance.to_i ,account[0].currency)
end
account_balance = Money.new( account[0].balance_in_cents.to_i,account[0].currency)
total_spent = Money.new(0,account[0].currency)
Expand All @@ -42,11 +42,11 @@ categories = Array.new
months_in_year[month_index] = previous_month.to_f
else
if previous_month.nil?
previous_month = account_balance - total_spent
previous_month = account_balance - total_spent + total
else
previous_month+= account_balance - total_spent + months_in_year[month_index]
previous_month+= total
end
months_in_year[month_index] = months_in_year[month_index].to_f
months_in_year[month_index] = previous_month.to_f
end
end
series <<{
Expand Down

0 comments on commit bff2ee7

Please sign in to comment.