beancount/fava

feature request: Reverse transactions order within a day

lo48576 opened this issue · 4 comments

Similar to #493, but this is a feature request with more limited scope.

Summary

I want an option to show transactions within each day in reverse order.
(This is not about the sort order of dates, which is already switchable.)
In other words, if there are multiple transactions with the same date, handle the first transaction in the file as the last transaction in the day, and the last in the file as the first in the day.

This might be a cosmetic stuff rather than the matter of correctness or consistency, but this will reduce confusion in some environment.

Working Example

option "operating_currency" "USD"

2024-03-15 balance Assets:Current:PrepaidCard 6 USD
2024-03-14 * "Store 3" "Yet another random item 3" ; 21:00
  Assets:Current:PrepaidCard -15 USD
  Expenses:SomeRandomItems
; 2024-03-14 balance Assets:Current:PrepaidCard 21 USD
2024-03-14 * "ATM 2" "Charge the prepaid card again" ; 18:00
  Assets:Current:PrepaidCard 20 USD
  Assets:Current:Savings:FooBarBank
; 2024-03-14 balance Assets:Current:PrepaidCard 1 USD
2024-03-14 * "Store 2" "Another random item 2" ; 15:00
  Assets:Current:PrepaidCard -16 USD
  Expenses:SomeRandomItems
; 2024-03-14 balance Assets:Current:PrepaidCard 17 USD
2024-03-14 * "ATM 1" "Charge the prepaid card" ; 12:00
  Assets:Current:PrepaidCard 15 USD
  Assets:Current:Savings:FooBarBank
; 2024-03-14 balance Assets:Current:PrepaidCard 2 USD
2024-03-14 * "Store 1" "Some random item 1" ; 09:00
  Assets:Current:PrepaidCard -8 USD
  Expenses:SomeRandomItems
2024-03-14 balance Assets:Current:PrepaidCard 10 USD


2024-02-01 balance Assets:Current:PrepaidCard 10 USD
2024-02-01 balance Assets:Current:Savings:FooBarBank 100 USD
2024-01-01 pad Assets:Current:PrepaidCard Equity:Opening-Balances
2024-01-01 pad Assets:Current:Savings:FooBarBank Equity:Opening-Balances

;include "_accounts.beancount"
; [BEGIN] _accounts.beancount
2024-01-01 open Assets:Current:PrepaidCard USD
2024-01-01 open Assets:Current:Savings:FooBarBank USD
2024-01-01 open Equity:Opening-Balances USD
2024-01-01 open Expenses:SomeRandomItems USD
; [END] _accounts.beancount

As you see, the first in the file (Store 3, 21:00) is the last in the day, and the last in the file" (Store 1, 09:00) is the first in the day.

Actual Result

The example above results in the capture below. See what happens to the "Balance" column.

2024-03-15-001758+0900

This is quite unintuitive... the balance of the prepaid card looks like going to negative, which usually never happens!

I know this is "correct" as beancount since it does not have smaller granularity than a day, which is the reason why I cannot put multiple balance with different values within a day.
In that sense, this might be "cosmetic" problem... even if the balance looks like "wrong" for human.
However, in this state, I'm sometimes confused as "hey, which is temporarily wrong value and which is the real balance I can trust!?"
This can be mitigated by putting bunch of balances (I do this), ideally everyday, but it is tiring and the confusing values still remain in the table.

Expected Result

What I wanted is, an option to switch the display order as below:

2024-03-15-002233+0900

Now the result looks quite natural, and reflects user's intention.

Another easier way to reduce confusion is, to make the text more visually suppressed (e.g. making it light gray) for the balances other than the last transaction of a day?
It will make it clear that which value I can trust while the "storange" balances still remains.
Personally, I prefer the original request (reverse order) to this idea (gray out).

I don't think this is a fava problem. In your beancount journal, the order is also the wrong way around. Why don't you reverse the entries there? Doesn't that fix the fava-problem you are having?

Don't get me wrong, I know beancount doesn't care about file-order, but it seems fava does, so changing the order in the file could also be the solution.

In your beancount journal, the order is also the wrong way around. Why don't you reverse the entries there? Doesn't that fix the fava-problem you are having?

I have entries reversed because it's easy to read and edit the recent transactions even when the editor is poor.
Of course it's easy to scroll to the end when I am using PC to edit this file, but it's not always so when I am using a smartphone.
(More context: I'm using fava as a desktop app in PC using Flatpak, and not having fava server that can be accessed from my phone.)

Reversing the entries ordering in the file (again) will solve the problem, but I'd like to order the entries just like fava does.
I want my files to be pretty as entries shown by fava are.
Changing order within day to old-to-new while ordering days new-to-old will be a possible mitigation on my side ("Twitter-TL-style"?), but it's less consistent so I prefer reversing everything.

I don't know how many people are doing this, but I've started using beancount with this style from the beginning because someone have been recommending this and I felt it's reasonable, so I believe at least another person on the earth would have reversed transactions in their beancount file...😅