Commit graph

16 commits

Author SHA1 Message Date
Brett Smith
581046f988 reports: Balance.format() respects tolerance. 2020-06-09 09:04:27 -04:00
Brett Smith
cd1766adcf reports: Balance.__eq__ respects tolerance. 2020-06-09 09:04:27 -04:00
Brett Smith
110e5038e1 reports: Balance.__init__ better handles multiple amounts of same currency.
This is something that should've happened with 3d704e286
but I didn't think of it at the time.
2020-06-09 09:04:27 -04:00
Brett Smith
0581525c98 reports: Add Balance.__pos__() method.
I did this while I was working on normalize_amount_func.
It turns out it's not immediately needed, but it's still nice to have.
2020-06-09 09:04:27 -04:00
Brett Smith
39fa977f71 reports: Balance.le/ge_zero returns False when exactly at tolerance. 2020-06-04 10:49:55 -04:00
Brett Smith
4cba2b2681 reports: Balance has built-in tolerance for zero comparisons. 2020-06-03 22:20:37 -04:00
Brett Smith
3d704e2865 reports: Balance is initialized with just amounts.
This works fine with how we're currently using it, makes transformation
methods easier to implement, and avoids potential bugs where a balance is
initialized with a bad mapping.
2020-06-03 18:54:12 -04:00
Brett Smith
069939b2d3 reports: Balance classes support addition. 2020-06-03 18:53:17 -04:00
Brett Smith
cc0656dde9 reports: Add Balance.__abs__() method. 2020-06-03 18:52:44 -04:00
Brett Smith
d8df34ebaf reports: Balance.format() accepts None as a format. 2020-05-28 09:03:23 -04:00
Brett Smith
2c44cc8f50 reports: Add Balance.format() method. 2020-05-28 09:03:19 -04:00
Brett Smith
3780c31c59 reports: Add Balance.__eq__() method.
It turns out the provided implementation gets us most of the way there,
we just needed to add handling for the special case of zero balances.
Now it's confirmed with tests.
2020-05-28 09:01:00 -04:00
Brett Smith
396173b55d reports.Balance: Add eq_zero, ge_zero, and le_zero methods.
Support for RT#11294.
2020-05-21 23:10:03 -04:00
Brett Smith
1b81375294 reports: Add Balance.__neg__() method. 2020-04-29 14:35:20 -04:00
Brett Smith
68acb86e7e reports: Add Balance.__str__() method. 2020-04-29 11:37:38 -04:00
Brett Smith
5aa30e5456 reports.core: Start Balance class. 2020-04-12 14:56:00 -04:00