Invert liability graphs to have correct signage (#1928)

This commit was merged in pull request #1928.
This commit is contained in:
Zach Gollwitzer
2025-02-28 12:17:25 -05:00
committed by GitHub
parent fa0248056d
commit 7c66f16750

View File

@@ -14,6 +14,7 @@ module Account::Chartable
])
balances = gapfill_balances(balances)
balances = invert_balances(balances) if favorable_direction == "down"
values = [ nil, *balances ].each_cons(2).map do |prev, curr|
Series::Value.new(
@@ -69,6 +70,13 @@ module Account::Chartable
SQL
end
def invert_balances(balances)
balances.map do |balance|
balance.balance = -balance.balance
balance
end
end
def gapfill_balances(balances)
gapfilled = []