Commit Graph

3443 Commits

Author SHA1 Message Date
Simon Michael
76f98f28fd ;doc: update manuals 2024-03-24 14:22:54 -10:00
aragaer
09e158d31e fix: Fill totals with correct amount of zeroes for empty reports 2024-03-17 10:52:53 -10:00
Dmitry Astapov
b0b9e69e4f ;dev:lib allow comment lines in the "if" table body 2024-03-08 07:42:58 -10:00
Simon Michael
169198ff55
Merge branch 'master' into fix-matchgroups 2024-03-02 12:15:52 -10:00
Jonathan Dowland
3b416a76ef ;cln:import: clarify haddock for getEffectiveAssignment
Signed-off-by: Jonathan Dowland <jon@dow.land>
2024-03-02 20:56:35 +00:00
Simon Michael
3ca208a3b6 fix:queries: fix OR-ing open-ended dates, spanUnion; add spanExtend [#2177] 2024-03-01 18:10:24 -10:00
Jonathan Dowland
c5079d4f1e dev:import: call hledgerFieldValue rather than re-implementing it
Signed-off-by: Jonathan Dowland <jon@dow.land>
2024-03-01 18:02:29 +00:00
Jonathan Dowland
1424a1f2f1 ;cln:import: update some Haddock strings to reflect #2158
Signed-off-by: Jonathan Dowland <jon@dow.land>
2024-03-01 17:58:28 +00:00
Simon Michael
1ee0e80719 imp:errors:unbalanced transaction: show more precise amounts (#2135)
Like we used to in 1.30, but better (show all available decimal digits,
unless they're infinite in which case show 8, show trailing zeros,
show commodity symbol with zero).
2024-02-29 12:34:17 -10:00
Simon Michael
3ec432bd53 dev: rename/improve amountSetFullPrecisionUpTo, add mixedAmountSetFullPrecisionUpTo 2024-02-29 12:31:07 -10:00
Jonathan Dowland
71684f5611 ref:import: simplify renderTemplate and friends
renderTemplate and its ancillary functions did not need the
HledgerFieldName argument, so remove it.

Signed-off-by: Jonathan Dowland <jon@dow.land>
2024-02-29 21:44:42 +00:00
Jonathan Dowland
b7027c8bbb feat:import: resolve matchgroup references in ConditionalBlock scope (#2158)
Adjust getEffectiveAssignment to compute an intermediary form of the
active assignments (with an additional Either wrapper to distinguish
top-level and conditional assignments) and move the remaining work to
its only caller, hledgerField.

Rework hledgerFieldValue. Instead of calling hledgerField, call
getEffectiveAssignment and--in the conditional block case--construct
a CsvRules scoped just to the active ConditionalBlock before calling
renderTemplate.

Adjust regexMatchValue to use rconditionalblocks to access conditional
blocks from the CsvRules, rather than rblocksassigning, since we haven't
narrowed the scope of that field.

The result is match group references are only expanded for match groups
that occur within the in-scope ConditionalBlock. Fixes: #2158.

Signed-off-by: Jonathan Dowland <jon@dow.land>
2024-02-29 21:44:40 +00:00
Jonathan Dowland
ac7f726282 ;ref:import: consistently use hledgerField
hledgerField is an alias to the function getEffectiveAssignment: both
names are used in various parts of RulesReader.

Treat hledgerField as the canonical name, and getEffectiveAssignment
as an implementation detail of hledgerField.

Replace all uses of getEffectiveAssignment with hledgerField (except the
one in hledgerField.)

Signed-off-by: Jonathan Dowland <jon@dow.land>
2024-02-29 21:44:39 +00:00
Jonathan Dowland
8f514ac16d ;test:import: test case for match groups (#2158)
Add a test which captures the issue of overlapping scope described
in GitHub issue #2158.

Signed-off-by: Jonathan Dowland <jon@dow.land>
2024-02-29 21:44:36 +00:00
Jonathan Dowland
bd5652c1c2 ;cln:import: remove superfluous comment lines
Signed-off-by: Jonathan Dowland <jon@dow.land>
2024-02-29 21:44:32 +00:00
Simon Michael
8f1ae401f4 dev: fix some partial head/tails, silence ghc 9.8's new warnings
Note the headErr/tailErr calls will print stack traces if they fail
(small ones: five lines, one of which is the useful location info),
which may or may not be best UX.
2024-02-28 15:58:21 -10:00
Simon Michael
697e5a5671 ;cabal: update cabal files 2024-02-28 15:34:11 -10:00
Simon Michael
3798a3baef pkg: require safe >=0.3.20, for ghc 9.8 head/tail helpers 2024-02-28 14:39:53 -10:00
Simon Michael
fac3ee89af feat:allow other kinds of unicode space as digit group separators
Based on feedback in chat, I added support for several more kinds of
Unicode space character for separating digit groups, both when reading
and when displaying numbers. These are the spaces currently supported,
which are just my best guess at the ones that might show up in CSV files
now and then:

space,
no-break space,
en space,
em space,
punctuation space,
thin space,
narrow no-break space,
medium mathematical space
2024-02-28 09:12:17 -10:00
Simon Michael
c7dd1fcc2f ;imp:cli:errors: make file-not-found error more format agnostic 2024-02-26 10:25:22 -10:00
Simon Michael
a4c2776a18 feat:close: support --round, like print 2024-02-25 17:37:59 -10:00
Simon Michael
d3ad743b36 imp: print, close: disambiguate balance assertion/assignment amount also (#2176)
Add a trailing decimal mark when necessary to disambiguate a single
digit group mark in the balance assertion/assignment amount, also.
2024-02-25 16:47:58 -10:00
Simon Michael
a871f274c4 fix:bal:budget: don't omit necessary parent accounts in tree mode (#2071)
Parent accounts with no actual or goal amounts would ideally be shown
elided on the same line, but the budget report in tree mode was
omitting them completely. Now --budget always shows them.
The effect is much like forcing --no-elide on, except it might not
show goal amounts that --no-elide does show.

It's not a wonderful fix, but the budget report code is twisty and I
can't afford to spend more time on this.
2024-02-25 01:23:39 -10:00
Simon Michael
c701e3a663 dev:budget: big refactor, clarify
Big functions like budgetReportAsTable are grouped as much as possible
into more modular sub-scopes.
2024-02-25 01:23:39 -10:00
Simon Michael
3cad760851 dev:budget: simplify some confusing fmaps 2024-02-25 01:23:31 -10:00
Simon Michael
ffdde364de imp:bal:budget:csv,tsv output: show 0 not empty when there's no amount 2024-02-24 18:21:42 -10:00
Simon Michael
37f9d6b239 dev:budget report: clarify code, add debug output 2024-02-24 18:21:42 -10:00
Simon Michael
5a36362b33 imp:journal: use a symlink's target's directory for relative include paths
When reading a symbolically-linked journal file,
relative paths in include directives are now evaluated
relative to the directory of the real linked file,
not the directory of the symlink.

This also seems to fix an obscure case where stats did not report
absolute included file paths in certain circumstances (stdin, maybe no
terminal..)
2024-02-22 08:48:31 -10:00
Simon Michael
f6a50923c2 imp: interpret glob patterns in $LEDGER_FILE
For example, LEDGER_FILE=2???.journal now works.
2024-02-22 07:32:37 -10:00
Simon Michael
e6b3fa0f54 dev:IO: comments 2024-02-22 07:32:10 -10:00
Simon Michael
60a1adc5ba lib: refactor, extract parseBalanceAssertionType 2024-02-20 20:55:27 -10:00
Simon Michael
85836eaa21 ;doc: update manuals 2024-02-18 14:59:10 -10:00
Simon Michael
baca5f8b54 fix:check:tags: add date and date2 to the implicitly-declared special tags
And add tests/comments.
2024-02-17 13:06:10 -10:00
Michael Rees
d4ecdb3fea imp: Support tsv and ssv prefixes (#2164) 2024-02-08 06:44:44 -10:00
Simon Michael
aa69eb188a ;doc: update changelogs 2024-01-28 02:34:54 -10:00
Simon Michael
12e67e4859 dev: postingAddInferredEquityPostings: cleanup 2024-01-26 15:04:44 -10:00
Simon Michael
21adfe2c25 fix: really fix slowdown with many accounts [#2153]
The previous #2153 fix used accountNameTreeFrom, but it turns out this
has always had O(n^2) performance, so our tests with 10k accounts ran
even slower than before. Now it's faster, the main #2153 slowdown
should really be fixed, and other commands which build an account tree
should also be free of this slowdown when there are very many accounts.
2024-01-26 13:53:47 -10:00
Simon Michael
a38af98c9e fix: a slowdown with many txns and many accounts since 1.29 [#2153]
When processing costs and equity postings in transactions during
journal finalisation, we now pass just the conversion account name(s)
rather than the entire map of account types. This slowdown was severe
for some users/data/machines.
2024-01-25 13:49:49 -10:00
Simon Michael
508ccfc7d2 imp: balance assertions error: show costs detail with --debug=2 2024-01-23 22:18:34 -10:00
Simon Michael
54c60b4de9 imp: balance assertions error: clarify wording 2024-01-23 22:18:34 -10:00
Simon Michael
e694e7869d fix: check mixed-cost balances correctly again; cleanup (#2150)
The code is a bit clearer, and it no longer discards amounts other
than the first when the running balance contains multiple costs.
(This bug was exposed by the fix for #2039).
2024-01-23 21:35:07 -10:00
Simon Michael
8ec46baec9 dev: clarify behaviour of filterMixedAmountByCommodity, showMixedAmount* 2024-01-23 21:35:06 -10:00
Simon Michael
df79aa5e35 dev: distinguish oneLineFmt and oneLineNoCostFmt; add fullZeroFmt 2024-01-23 21:35:06 -10:00
Simon Michael
999cba8c31 dev: cleanup; add showAmountWith, showMixedAmountWith 2024-01-23 21:35:06 -10:00
Simon Michael
0cb382cf0e dev: rename AmountDisplayOpts -> AmountFormat, and related constants
noColour          -> defaultFmt
noCost            -> noCostFmt
oneLine           -> oneLineFmt
csvDisplay        -> machineFmt
2024-01-23 21:35:06 -10:00
Simon Michael
e2ed2b3b6d dev: clarify showAmountsCostB 2024-01-23 21:35:06 -10:00
Simon Michael
ca55c2f0f8 dev: rename other Price helpers to Cost
showAmountWithoutPrice             -> showAmountWithoutCost
mixedAmountStripPrices             -> mixedAmountStripCosts
showMixedAmountWithoutPrice        -> showMixedAmountWithoutCost
showMixedAmountOneLineWithoutPrice -> showMixedAmountOneLineWithoutCost
2024-01-23 21:35:06 -10:00
Simon Michael
323f87b3e9 dev: Amount: aprice -> acost
Acked-by: Simon Michael <simon@joyful.com>
2024-01-23 21:35:06 -10:00
Simon Michael
8102bd9c2b dev: AmountPrice,UnitPrice,TotalPrice -> AmountCost,UnitCost,TotalCost; related renames 2024-01-23 21:35:06 -10:00
Simon Michael
e201775e93 dev: amountStripPrices -> amountStripCost 2024-01-23 21:35:06 -10:00