reg: test and fix for --average, broken since 1.12 (#1003)
This commit is contained in:
parent
71f9b74b0e
commit
13dc1096a5
@ -81,8 +81,8 @@ postingsReport opts q j = (totallabel, items)
|
||||
startbal | average_ opts = if historical then precedingavg else 0
|
||||
| otherwise = if historical then precedingsum else 0
|
||||
startnum = if historical then length precedingps + 1 else 1
|
||||
runningcalc | average_ opts = \i avg amt -> divideMixedAmount (fromIntegral i) avg + amt - avg -- running average
|
||||
| otherwise = \_ bal amt -> bal + amt -- running total
|
||||
runningcalc | average_ opts = \i avg amt -> avg + divideMixedAmount (fromIntegral i) (amt - avg) -- running average
|
||||
| otherwise = \_ bal amt -> bal + amt -- running total
|
||||
|
||||
totallabel = "Total"
|
||||
|
||||
|
||||
18
tests/register/average.test
Normal file
18
tests/register/average.test
Normal file
@ -0,0 +1,18 @@
|
||||
2019-1-1
|
||||
(a) 1.0
|
||||
|
||||
2019-1-2
|
||||
(a) 1
|
||||
|
||||
2019-1-3
|
||||
(a) 1
|
||||
|
||||
2019-1-4
|
||||
(a) 1
|
||||
|
||||
$ hledger -f- register -A
|
||||
2019/01/01 (a) 1.0 1.0
|
||||
2019/01/02 (a) 1.0 1.0
|
||||
2019/01/03 (a) 1.0 1.0
|
||||
2019/01/04 (a) 1.0 1.0
|
||||
>=
|
||||
Loading…
Reference in New Issue
Block a user