| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
Do not serialize to string just to get rounded value.
`in_place_roundto` should be reliable enough now.
|
| |
|
|
|
|
|
|
|
|
|
| |
There is no parse_context_stack for generated transactions, because they
were not parsed from anywhere. This breaks strict checking, because
errors can't be reported.
It doesn't make sense to report errors for these anyway, so lets just
disable them.
|
|
|
|
|
|
| |
The smatch does not copy the input, it points to the original. So if the
string is on the stack and goes out of scope because it's only used as a
parameter, it will just be junk. Make a copy of it at a higher scope.
|
| |
|
|
|
|
|
| |
- Add some tests from comments to pull request #2361.
- Fix decimal separator in earlier added tests.
|
|
|
|
|
|
|
|
|
| |
Expose `roundto` and `in_place_roundto` to `Amount`, `Balance`, and
`Value` Python classes. They may be handy for debugging.
The methods were added after introducing of bindings and likely
it is a reason why they were missed.
Closes: #2365
|
|
|
|
|
|
| |
This reverts commit e2f64be216506b51c029147982f1addc50f4c745.
post->cost is actually of type optional, so the cast to bool iscorrect.
|
| |
|
|
|
|
| |
fixes #2268
|
| |
|
|
|
|
|
| |
fix https://github.com/ledger/ledger/issues/2338
fix https://github.com/ledger/ledger/issues/2340
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Copy amount quantity before rounding.
- Fix `amount_t::roundto(int)`.
- Transform `balance/testRound` into `balance/testRoundto`.
It was a mix of `round` and `roundto` operation with unclear purpose
and was relying on `in_place_roundto` behavior modifying all copies.
There is no unit tests for balance `round` and `unround` any more.
Closes #2362
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
| |
Co-authored-by: Alexis Hildebrandt <afh@surryhill.net>
|
|
|
| |
Co-authored-by: Alexis Hildebrandt <afh@surryhill.net>
|
|
|
| |
Co-authored-by: Alexis Hildebrandt <afh@surryhill.net>
|
|
|
| |
Co-authored-by: Alexis Hildebrandt <afh@surryhill.net>
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Also, support matching provided hashes against a prefixed of the generated
hash.
|
| |
|
| |
|
|
|
|
|
| |
At the moment only "sha512" or "SHA512" is accepted, but this could extend to
more algorithms in the future.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The following details of a posting contribute to its hash:
fullname of account
string representation of amount
Each posting hashes contributes to the transaction hash, which is compromised
of:
previous transaction’s hash (as encountered in parsing order)
actual date
optional auxiliary date
optional code
payee
hashes of all postings
Note that this means that changes in the “code” or any of the comments
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Multiprecision rational created from a double value may have large power
of 2 denominator since fractional decimal numbers can not be represented
as binary floating point numbers. It leads to failed assertion when
result is compared to a value converted directly from strings.
Use integer multiprecision arithmetics to round numbers to ensure
proper denominator. Inspired by python gmpy2 package
<https://github.com/aleaxit/gmpy/blob/3e4564ae9d/src/gmpy2_mpq_misc.c#L315>
The change makes `roundto` symmetric for positive/negative arguments.
Halves are rounded to nearest even. Rounded away from zero are discussed
in #1663 and it may be achieved with minimal modification.
- See #2329
- Closes #1983
|
|\ |
|
|/
|
|
|
|
|
|
|
| |
The script has a syntax error, caused by commit 815305b9: in escape_string()
function the first argument to re.sub() was probably changed unintentionally.
This reverts this one line. To test, I used acprep to build the binary locally,
which succeeded. More testing might be needed, I don't have enough context to
do that.
|
|
|
|
| |
[ci skip]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When the account name is longer than the --account-width (default 36),
the amounts stop aligning:
2023/01/01 Transaction with long account names
Assets:Very:Long:Account:Name:That:Will:Push:The:Amount -10 ABC
Assets:Another:Long:Account:Name:That:Will:Push:The:Amount -10 ABC
Expenses:Short 20 ABC
One can set a larger --account-width, but that is not a great solution
for cases where you have only a few accounts with problematically long
names. Instead, keep the current account width wherever possible, but
when an account name is longer than the account width, account for that
and still align the values:
2023/01/01 Transaction with short account names
Assets:Short -10 ABC
Assets:Short -10 ABC
Expenses:Short 20 ABC
2023/01/01 Transaction with long account names
Assets:Very:Long:Account:Name:That:Will:Push:The:Amount -10 ABC
Assets:Another:Long:Account:Name:That:Will:Push:The:Amount -10 ABC
Expenses:Short 20 ABC
This is similar to hledger's behavior.
|
| |
|
| |
|
|
|
|
| |
Fixes #2324
|
| |
|
|
|
|
|
|
| |
as "the global configuration variable Py_UnbufferedStdioFlag was
deprecated in Python 3.12 and using PyConfig.buffered_stdio is
recommended instead." — https://peps.python.org/pep-0741/
|