Hi all,

I'm trying to write assertions about account totals, but I ran into an issue 
demonstrated in the following ledger file:

------------------------------------------------------------------------
2017-01-01 * Test
    Expenses  $3
    Income

eval print("Income total: " + account("Income").total)
eval print("Income amount: " + account("Income").amount)

2017-01-01 * Test
    Expenses  $5
    Income

eval print("Income total: " + account("Income").total)
eval print("Income amount: " + account("Income").amount)

2017-01-01 * Test
    Expenses  $7
    Income

eval print("Income total: " + account("Income").total)
eval print("Income amount: " + account("Income").amount)

eval print("Income total: " + account("Income").total)
eval print("Income amount: " + account("Income").amount)
------------------------------------------------------------------------

Running ledger -f test.ledger bal produces this

    Income total: $-3
    Income amount: $-3
    Income total: $-11
    Income amount: $-8
    Income total: $-26
    Income amount: $-15
    Income total: $-26
    Income amount: $-15
                     $15  Expenses
                    $-15  Income
    --------------------
                       0

Where do the '$-11' and '$-26' come from?  It appears that $-3 was 
double-counted to get to $-11, and that $-3 was triple-counted (and $-5 
double-counted) to get to $-26, but why?

Is this a bug? Could it be that 'total' uses a cache that doesn't get reset 
between each call?
If not, can someone explain the difference between ".amount" and ".total"?

Thanks!
Clément.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to