Commit Graph

1376 Commits

Author SHA1 Message Date
Aleksandar Dimitrov
63cda87e86 Whitespace 2020-01-05 14:45:57 -08:00
Simon Michael
ce5eccfbc0 ;spelling fix
[ci skip]
2020-01-04 21:17:50 -08:00
Stephen Morgan
228edf6ba6 Don't store leaf name in PeriodReport.
Calculate at the point of consumption instead.
2020-01-04 21:15:42 -08:00
Stephen Morgan
2e20d0717f lib: Generalise PeriodicReport to be polymorphic in the account labels. 2020-01-04 17:23:17 -08:00
Stephen Morgan
88dc619257 lib: Use records instead of tuples in PeriodicReport. 2020-01-04 17:23:17 -08:00
Stephen Morgan
beb8b6d7c8 lib: Use PeriodicReport in place of MultiBalanceReport. 2020-01-04 17:23:17 -08:00
Stephen Morgan
74778efcf5 Use nubSort instead of nub . sort. 2020-01-04 08:31:10 -08:00
Stephen Morgan
38904372b2 Calculate MultiReportBalance columns more efficiently.
Only calculate posting date once for each posting, and calculate their
columns instead of checking each DateSpan separately.
2020-01-03 16:11:46 -08:00
Simon Michael
0b734be445 ; silence safe 0.3.18's deprecation warnings for now
(max|min)imum(By)?Def are being replaced by (max|min)imumBound(By)?
but the old functions have the semantics I want and
I don't understand the new ones yet.
This can hide other deprecation warnings in this file,
and presumably the old functions will be removed later,
so this is temporary.
Cf https://github.com/ndmitchell/safe/issues/26
2019-12-28 15:52:32 -08:00
Simon Michael
c5537cedb5 ;lib: drop more unnecessary toJSON calls 2019-12-27 15:49:42 -08:00
Stephen Morgan
b9b16da8ed Correct finding latest date in queryEndDate Or queries and simplify date
comparison code.
2019-12-24 05:04:51 -08:00
Brian Wignall
2852f9dbee Fix typos 2019-12-21 12:09:05 -08:00
Simon Michael
7fa7ccc033 ToJSON instances for all (?) remaining data types, up to Ledger 2019-12-16 17:17:00 -08:00
Simon Michael
46d516e7a3 move JSON instances from hledger-web to hledger-lib 2019-12-16 17:17:00 -08:00
Simon Michael
47567cd770 ;fix some warnings with GHC 8.10 alpha
hledger is GHC 8.10 ready!
2019-12-14 17:30:19 -08:00
Simon Michael
c759c9b3de ;lib: fix some more warnings in Transaction 2019-12-09 06:08:03 -08:00
Simon Michael
13e6c7dfdf lib: drop "assertion" alias for nullassertion
Perhaps we'll stick with the null* convention. Fixes a warning in Transaction.hs.
2019-12-09 06:08:03 -08:00
Jacek Generowicz
29211868bb Fix issue 457
Issue #457 pointed out that commands such as

    hledger ui 'amt:>200'

failed. This was becasue the process of dispatching from `hledger ui`
to `hledger-ui` (note addition of `-`) lost the quotes around
`amt:>20` and the `>` character was interpreted as a shell redirection
operator, rather than as part of the argument.

The machinery for quoting or escaping arguements which cointain
characters which require quoting or escaping (thus far whitespace and
quotes) already existed. This solution simply adds shell stdio
redirection characters to this set.

Fixes #457
2019-12-08 18:33:43 +01:00
Simon Michael
62a9e1aa62 ;lib: clarify Hledger.Read imports a little 2019-12-02 08:21:06 -08:00
Simon Michael
a0b92e02b9 Revert "remove old fail compatibility imports that are obsolete ?"
They are needed with ghc <8.4, not for fail but for <> I think.
Try cleaning up again another time.
This reverts commit 318ce7eb07.
2019-12-01 11:32:51 -08:00
Simon Michael
318ce7eb07 remove old fail compatibility imports that are obsolete ? 2019-12-01 08:31:50 -08:00
Simon Michael
279e9624ed ;lib: clarify docs for setFullPrecision, setNaturalPrecision 2019-11-30 16:56:45 -08:00
Simon Michael
2b2a0b3cf8 ;tests: use "test" alias for testCase everywhere
Easier to type and read, and a little clearer to my eyes;
"testCase" implies a single case, but it can contain many assertions.
2019-11-28 15:33:33 -08:00
Simon Michael
030b633cd6 ;fix build issues with old GHC versions 2019-11-28 15:22:12 -08:00
Simon Michael
5dac8af2ef ;ui: fix build error due to tests rewrite 2019-11-27 21:54:31 -08:00
Simon Michael
b36f6df110 tests: port all unit tests to tasty, second pass (#1090)
Hledger.Util.Tests helpers have been cleaned up, and test names are
now shown.

Tests have been cleaned up a bit. Some groups of unnamed tests have
been collapsed into a single named test containing a sequence of
assertions. The test command counts named tests, not assertions, so
the reported unit test count has dropped from 199 to 188.
2019-11-27 13:17:34 -08:00
Simon Michael
13a3542464 tests: port all unit tests to tasty, first cut (#1090)
easytest is not actively maintained and requires an old version of
hedgehog which does not support base-compat 0.11 & ghc 8.8.

This is still using the old easytest helpers, and not displaying test
names properly.
2019-11-27 12:43:43 -08:00
Simon Michael
3f0892556d ;lib: clarify choiceopt doc 2019-11-23 13:03:26 -08:00
Dmitry Astapov
aa051a05cf lib: support generation of (un)balanced virtual postings in csv reader 2019-11-23 10:28:10 -08:00
Simon Michael
332624f9fa ui: B and V keys toggle display of cost, value 2019-11-21 17:33:04 -08:00
Brian Wignall
f8269e21ab Fix some simple typos 2019-11-20 13:33:33 -08:00
Mykola Orliuk
2a36ac0d62 ;lib: fix doctest for RawOptions 2019-11-19 20:43:19 +01:00
Mykola Orliuk
097486a247 ;lib: re-enable doctests 2019-11-19 03:58:56 -08:00
Mykola Orliuk
5287fe671b ;all: hide RawOpts internals
This way we can ensure we always use only functions from RawOptions.
2019-11-18 17:38:39 -08:00
Mykola Orliuk
31ae3d3aaf ;lib: drop SystemString left from GHC pre 7.2
We are relying on base-4.9 or newer. Thus we don't compile anymore with
GHC version lower than 8.0.1.
2019-11-18 17:38:39 -08:00
Simon Michael
68b1cacf0f lib: refactor, prepare to drop showTransactionUnelided functionality
It seems we don't use it at all, and ony says it's not robust with
prices either.

Merge remote-tracking branch 'ony/chores/drop-elide-in-showTransaction'
2019-11-18 17:27:30 -08:00
Simon Michael
4cb2a03f7f ;lib: more docs for unifyMixedAmount
[ci skip]
2019-11-18 17:22:42 -08:00
Michael Kainer
79ca4a767e cli: Add -% to compound balance commands
This commit introduces the commandline argument -%/--percent to show
percentages of the column's total instead of the absolute amounts for
each account in reports. The signs of the values are preserved.

This option is especially useful for the balance and incomestatement
commands.

If there are multiple commodities involved in a report hledger bails
with an error message. This can be avoided by using --cost. Also note
that if one uses -% with the balance command the chances are high that
all numbers are 0. This is due to the fact that by default balance sums
up to zero. If one wants to use -% in a meaningful way with balance one
has to add a query.

In order to keep the implementation as simple as possible --tree has no
influence over how the percentages are calculated, i.e., the percentages
always represent the fraction of the columns total. If one wants to know
the percentages relative to a parent account, one has to use a query to
narrow down the accounts.
2019-11-18 17:10:59 -08:00
Mykola Orliuk
aca214b0ac lib: drop amount elision in showing last posting
This behavior is highly depends on journal. If we want to re-introduce
it we'd better re-consider how transaction entry can be "simplified".
I.e. besides dropping last amount we may drop prices that can be assumed
implicitly.
Note that there is no need to knit it into showTransaction since it
easily achievable with pre-processing (similar to implicit balances
etc).
2019-11-16 12:53:07 +01:00
Dmitry Astapov
c4d650e6ad lib: balance-style -> balance-type 2019-11-13 09:06:25 -08:00
Dmitry Astapov
39bc183340 lib: csv reader gets balance-style directive 2019-11-13 09:06:25 -08:00
Simon Michael
fb3c1a132c csv: fix parsing of whitespace on line after an if block (fix #1120) 2019-11-13 05:41:32 -08:00
Dmitry Astapov
94f912e558 lib: better resolution of csv field aliases ("balance" vs "balance1", etc) 2019-11-12 12:20:09 -08:00
Simon Michael
c4d7cc198a csv: finalise and check journals generated from CSV (#1000)
Invalid transactions generated from CSV will now be rejected.
I updated some csv tests to avoid this, except for 21, which
probably needs more cleanup.
2019-11-07 18:58:12 -08:00
Simon Michael
5264a7ebc1 ;lib: refactor, split out finaliseJournal 2019-11-07 18:08:41 -08:00
Dmitry Astapov
fc001da1ef lib: expenses:unknown is a much better default account name 2019-11-05 21:16:42 +00:00
Dmitry Astapov
c66ccc5cee lib: do not try to balance transaction in csv reader 2019-11-05 21:16:42 +00:00
Dmitry Astapov
95ec5715cc lib: better compatibility code in csv reader 2019-11-05 21:16:42 +00:00
Dmitry Astapov
d62f84bec2 lib: csv reader does not generate postings if account="" 2019-11-05 21:16:42 +00:00
Dmitry Astapov
8d24a40150 lib: csv parser fills out amounts on all postings, if possible 2019-11-05 21:16:42 +00:00