View Issue Details

IDProjectCategoryView StatusLast Update
0005022Talerobsolete componentpublic2018-04-15 20:34
ReporterChristian Grothoff Assigned ToMarcello Stanisci  
PriorityhighSeveritytweakReproducibilityN/A
Status closedResolutionfixed 
Platformi7OSDebian GNU/LinuxOS Versionsqueeze
Product Versiongit (master) 
Target Version0.5Fixed in Version0.5 
Summary0005022: amounts.py should define a class
DescriptionRight now, amounts in Python are simply represented as a 'dict'. It would seem cleaner to have a proper class "taler.amount" with three fields and methods to add/subtract/cmp/stringify/floatify, and constructors to parse (zero, CUR:val.frac).

Also, the existing functions lack type annotations.

Finally, the use of "settings.TALER_CURRENCY" should be avoided (get_zero) and instead the currency should be passed as an argument, as there may be multiple currencies used in the same application eventually, and the fundamental 'amount' abstraction should not depend on one currency being given in settings.
TagsNo tags attached.

Activities

Marcello Stanisci

2017-10-26 17:54

reporter   ~0012515

such a class should never floatify any amount object: this operation does round numbers up, therefore making money disappear!

Marcello Stanisci

2017-10-26 18:41

reporter   ~0012516

This class needs tests.

Marcello Stanisci

2017-10-30 16:33

reporter   ~0012527

this feature was implemented at d0409b47b9fa from the 'copylib' repository. Manually copy the sources into any project where they are needed.

Issue History

Date Modified Username Field Change
2017-05-22 14:45 Christian Grothoff New Issue
2017-05-22 14:45 Christian Grothoff Status new => assigned
2017-05-22 14:45 Christian Grothoff Assigned To => Marcello Stanisci
2017-05-22 14:45 Christian Grothoff Summary amounts.py should probably define a class => amounts.py should define a class
2017-10-23 10:25 Christian Grothoff Priority normal => high
2017-10-23 10:25 Christian Grothoff Target Version => 0.5
2017-10-26 17:54 Marcello Stanisci Note Added: 0012515
2017-10-26 18:41 Marcello Stanisci Note Added: 0012516
2017-10-30 16:33 Marcello Stanisci Status assigned => resolved
2017-10-30 16:33 Marcello Stanisci Resolution open => fixed
2017-10-30 16:33 Marcello Stanisci Note Added: 0012527
2017-10-31 09:10 Christian Grothoff Fixed in Version => 0.5
2018-04-15 20:34 Christian Grothoff Status resolved => closed
2022-08-23 20:26 Christian Grothoff Category bank (demonstrator) => py bank (demonstrator, obsolete)
2023-12-03 01:23 Christian Grothoff Category py bank (demonstrator, obsolete) => obsolete componet
2023-12-11 20:08 Florian Dold Category obsolete componet => obsolete component