Hawk777/grisbi2ledger

Reconciliations are in the wrong places

Opened this issue · 0 comments

Reconciliations are not output in proper chronological order with other transactions. This is because, although a reconciliation has a date, simply inserting the reconciliation transaction at the point where its date suggests may not work properly. In Grisbi, a reconciliation can exclude transactions that appear earlier than its own date (e.g. for bank transactions which have not cleared yet); therefore, Grisbi2ledger constructs a dependency graph between transactions based on which reconciliation contains each transaction and topologically sorts the transactions (using date as a secondary sorting key), then inserts each reconciliation immediately preceding the first transaction which is not part of it.

A better solution would probably be to add the reconciliation as nodes in the graph, with edges leading from every transaction to the reconciliation that contains it and from each reconciliation to the next reconciliation as well as every transaction within it, then topologically sort both the transactions and the reconciliations together using the date as a secondary key.

This would also fix a secondary bug in which reconciliations are not generated at all if they do not cover any transactions.