Open the report on last month

The report answered for the whole index, which is the one window a spending
report is least often asked for: last January's groceries sat in the same total
as last week's, and nothing on screen said which was which. It now opens on the
month that has just ended -- the last one a statement can be complete for --
and left/right step along an axis beside the totals, from all time down through
the named windows to the oldest month the index holds.

The period narrows the report and nothing else. reloadReport runs its own query
rather than reusing the rows the transaction list is showing: the two share the
account, the search and the untagged toggle, and differ only in the date
bounds, so opening on last month must not hide the rest of the index from the
list beside it. Nothing may put the period into m.filter, which is exactly what
would make it leak.

The windows are relative to today, never to the newest statement. "Last month"
with nothing in it reports nothing and says so, because silently answering for
a month nobody asked for is worse than an empty screen; an empty period and an
empty index therefore give different messages, one asking for another period
and the other for an import. The rolling windows run to the end of this month
rather than to the last complete one -- "last 3 months" is asked in order to
see what is happening now, and leaving out the days since the 1st answers a
question nobody put. The axis is built over the whole index rather than the
rows in view, or it would grow and shrink as the account or search filter
changed and move under the cursor; a reload rebuilds it, since an import can
reach further back, but keeps the window the user was on.

s cycles how those rows are arranged: largest out first as before, then in, net
lowest first so the biggest losses lead, count, and the tag A to Z. A letter
rather than a chord because the report is not a form. The marked heading says
which column the rows are read from and the help names what the key does next,
as the rule builder's preview already does. The sort rearranges rows and never
changes which rows there are, so the order stays out of the filter for the same
reason the period does. Currency remains the outer key under every order --
there are no rates here, so two currencies interleaved by amount would invite a
comparison that cannot be made -- and every order falls back to the tag, so
ties keep a fixed position instead of reshuffling between reloads.

money report takes the same choice as --sort out|in|net|count|tag, and a
misspelt one is refused rather than silently reporting in the default order. It
keeps --month and has no equivalent of the wider windows.

store.Filter gains From and To, compared as strings because dates are stored
ISO-8601 and a string comparison is therefore a date comparison. store.Months
replaces report.Months, which nothing had ever called: the axis needs the
months of the whole index, not of a slice already in hand.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-23 15:45:23 +02:00
co-authored by Claude Opus 5
parent 656e7e1de4
commit 7d4c3eba17
10 changed files with 1236 additions and 45 deletions
+55 -1
View File
@@ -68,6 +68,7 @@ money ls --untagged --uniq # the same, one row per distinct description
money ls --wide # also show type and reported balance
money ls --account checking --month 2026-01
money report --month 2026-01 # spending by tag
money report --sort count # ordered by number of transactions, not amount
money accounts # balances
money parsers # available statement parsers
money config # which data root is in use, and why
@@ -113,12 +114,65 @@ combined with `--wide`, whose columns all belong to a single transaction.
| `/` | filter by description |
| `u` | show only untagged transactions (matched transfer legs are not among them) |
| `a` | clear the account filter |
| `←` `→` | move the report's period (report view) |
| `s` | change how the report is sorted (report view) |
| `i` | import · `r` re-apply rules · `q` quit |
There is no key that tags a transaction. Tags come from `rules.toml` and
nowhere else, so tagging what you are looking at means writing a rule for it on
`4` — which is why that screen shows you what a glob catches before you save.
### Report (`3`)
The report opens on **last month**, not on everything you have ever imported:
an all-time total is the one number a spending report is least often asked for,
and the month that has just ended is the last one your statements can be
complete for. If you have not downloaded that month yet, the screen says the
period is empty rather than quietly showing you a different one.
`←` and `→` move along the time axis on the left of the totals, which runs from
the widest window down to the oldest month in the index:
```
Period Tag Cur Out In Net N
all time groceries EUR 10.00 0.00 -10.00 1
this year TOTAL EUR 10.00 0.00 -10.00
last 12 months
last 3 months
this month
▸ last month
2026-05
2026-04
```
The three rolling windows run to the end of *this* month rather than to the
last complete one — you ask for "last 3 months" to see what is happening now,
and leaving out the days since the 1st would answer a different question. Each
month below `last month` is a month the index actually holds; months that a
named window above already covers are not repeated. The axis is hidden on a
terminal too narrow for it and the totals both, where the title still names the
period.
`s` cycles how the rows are arranged, and the marked column heading says which
one they are arranged by: `Out ▾` largest spend first (the default question a
spending report answers), then `In ▾`, `Net ▾` lowest first so the biggest
losses lead, `N ▾` most transactions first, and `Tag ▴` A→Z. `money report`
takes the same choice as `--sort out|in|net|count|tag`.
Currency is always the outer grouping and no sort changes that — there are no
exchange rates here, so two currencies interleaved by amount would invite a
comparison between numbers that cannot be compared. Rows that tie fall back to
the tag, so they keep a fixed position rather than shuffling between reloads.
The sort rearranges rows; it never changes which rows there are.
The period narrows the report and only the report. The account filter (`a`,
`enter`), the search (`/`) and the untagged toggle (`u`) are shared with the
transaction list as before, so opening on last month does not hide the rest of
the index from `2`.
`money report` takes `--month` instead; there is no command-line equivalent of
the wider windows.
### Rule builder (`4`)
Writing rules by hand means guessing what a glob will catch. This screen shows
@@ -512,7 +566,7 @@ transfers excluded: 2 legs in EUR, 500.00 out, 495.00 in, 5.00 in fees
```
The report screen (`3`) shows the same thing under its `TOTAL`, the fee on its
own row:
own row (for whichever period it is on):
```
TAG CUR OUT IN NET N