fix: balance: Balance reports with --depth=0 should report on true
values, not zero everywhere. (#1761)
This commit is contained in:
parent
c11d19a893
commit
186995fc8b
@ -311,12 +311,11 @@ calculateReportMatrix rspec@ReportSpec{_rsReportOpts=ropts} j priceoracle startb
|
|||||||
-- Transpose to get each account's balance changes across all columns, then
|
-- Transpose to get each account's balance changes across all columns, then
|
||||||
-- pad with zeros
|
-- pad with zeros
|
||||||
allchanges = ((<>zeros) <$> acctchanges) <> (zeros <$ startbals)
|
allchanges = ((<>zeros) <$> acctchanges) <> (zeros <$ startbals)
|
||||||
acctchanges = dbg5 "acctchanges" . addElided $ transposeMap colacctchanges
|
acctchanges = dbg5 "acctchanges" $ transposeMap colacctchanges
|
||||||
colacctchanges = dbg5 "colacctchanges" $ map (second $ acctChangesFromPostings rspec) colps
|
colacctchanges = dbg5 "colacctchanges" $ map (second $ acctChangesFromPostings rspec) colps
|
||||||
|
|
||||||
avalue = acctApplyBoth . mixedAmountApplyValuationAfterSumFromOptsWith ropts j priceoracle
|
avalue = acctApplyBoth . mixedAmountApplyValuationAfterSumFromOptsWith ropts j priceoracle
|
||||||
acctApplyBoth f a = a{aibalance = f $ aibalance a, aebalance = f $ aebalance a}
|
acctApplyBoth f a = a{aibalance = f $ aibalance a, aebalance = f $ aebalance a}
|
||||||
addElided = if queryDepth (_rsQuery rspec) == Just 0 then HM.insert "..." zeros else id
|
|
||||||
historicalDate = minimumMay $ mapMaybe spanStart colspans
|
historicalDate = minimumMay $ mapMaybe spanStart colspans
|
||||||
zeros = M.fromList [(span, nullacct) | span <- colspans]
|
zeros = M.fromList [(span, nullacct) | span <- colspans]
|
||||||
colspans = map fst colps
|
colspans = map fst colps
|
||||||
|
|||||||
@ -8,20 +8,19 @@ hledger -f sample.journal balance --no-total --depth 1
|
|||||||
>>>=0
|
>>>=0
|
||||||
|
|
||||||
# 2. Depth 0 aggregates everything into one line
|
# 2. Depth 0 aggregates everything into one line
|
||||||
hledger -f sample.journal balance --no-total --depth 0
|
hledger -f sample.journal balance --no-total --depth 0 assets
|
||||||
>>>
|
>>>
|
||||||
0 ...
|
$-1 ...
|
||||||
>>>=0
|
>>>=0
|
||||||
|
|
||||||
# 3. Ditto in a multi-column balance report.
|
# 3. Ditto in a multi-column balance report.
|
||||||
hledger -f sample.journal balance -M -e 2008/2 --depth 0
|
hledger -f sample.journal balance -M -e 2008/2 --depth 0 assets
|
||||||
>>>
|
>>>
|
||||||
Balance changes in 2008-01:
|
Balance changes in 2008-01:
|
||||||
|
|
||||||
|| Jan
|
|| Jan
|
||||||
=====++=====
|
=====++=====
|
||||||
... || 0
|
... || $1
|
||||||
-----++-----
|
-----++-----
|
||||||
|| 0
|
|| $1
|
||||||
>>>=0
|
>>>=0
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user