I'm not sure I can whether the automated transaction's posting get inserted
before or after the posting that triggered them, as I don't expect to be
able to make assertions inside a transaction that is affected by an
automated transaction. I think what I care about is that transactions
affected by automated transactions don't ever exist in a partially-complete
state.

To be clear, the error that I'm trying  to point out is not that the
automated transaction didn't apply "in-time" to the 3rd transaction, the
one on 01/03, but that it didn't apply correctly to the *second*
transaction, the one on 01/02. Right now it seems that the automated
transaction is only processed after all transactions have been processed,
instead of "in-line". To explain in code, I think the current process is
something like (in Python):

```
for transaction in transactions_from(some_file):
    transaction.check_assertions()
    book.add(transaction)

for transaction in book:
    book.apply_automated(transaction)
```

What I think it *should* be is more like

```
for transaction in transactions_from(some_file):
    transaction.check_assertions()
    book.apply_automated(transaction)
    book.add(transaction)
```

Disclaimer: I haven't read any of the ledger source code, and I don't know
C++. This is just based on a guess of how I might write a ledger-like-tool.

On Sun, Feb 19, 2017 at 9:48 AM John Wiegley <jo...@newartisans.com> wrote:

> >>>>> "MC" == Michael Cooper <myth...@gmail.com> writes:
>
> MC> It seems that the automated transaction has not taken affect when the
> MC> balance assertion is evaluated. I consider this a bug.
>
> Looking at the code, it seems we handle balance assertions right away,
> before
> automated transactions are processed.
>
> The problem with reversing the order is this: The ordering of the postings
> in
> the transaction is significant. If all the automated transactions's
> postings
> just get added to the end (which is what happens), it won't change the
> behavior to what you're expecting.
>
> It seems like what you want to happen is that the automated transaction's
> posting get inserted immediately *before* the posting the triggered them.
> This
> is the only way they could effect the balance assertions, but it seems a
> bit
> of a strange place to insert them...
>
> --
> John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
> http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2
>

-- 

--- 
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 ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to