Opened 7 years ago
Last modified 7 years ago
#13405 new defect
sum totalhours returns int instead decimal
Reported by: | Rochi | Owned by: | Russ Tyndall |
---|---|---|---|
Priority: | normal | Component: | TimingAndEstimationPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 1.2 |
Description (last modified by )
Trac 1.2.2
TimingAndEstimationPlugin 1.5.7b0
MariaDB 10.0.34
If I enter a decimal value for hours like 0.5 the totalhours field is always increased to the next integer value (here 1).
The code casts the newvalue with
CAST( newvalue AS DECIMAL)
But if you look to the mysql or mariadb documentation "DECIMAL" is used as "DECIMAL(10,0)" so the scale is 0 (number of digits after the decimal point).
see
https://mariadb.com/kb/en/library/decimal/
https://dev.mysql.com/doc/refman/5.5/en/fixed-point-types.html
So the cast have to look like
CAST( newvalue AS DECIMAL(10,2))
I've attached a patch.
Attachments (1)
Change History (7)
Changed 7 years ago by
Attachment: | ticket_daemon.py.patch added |
---|
comment:1 Changed 7 years ago by
Description: | modified (diff) |
---|
comment:2 Changed 7 years ago by
Thanks so much for the patch.
I am in a multi trac environment and never actually use the default reports (as we have trac integrated with our billing system), so I would never have caught that. I also have been using postgres instead of mysql.
I will apply the patch as that makes perfect sense.
comment:4 Changed 7 years ago by
Never mind. But please apply my patch (see attached patch) also to ticket_daemon.py to fix the issue in the ticket view.
comment:5 Changed 7 years ago by
Sorry, I missed that -- it does make me wonder how I have never hit this bug.
I will apply a patch in a moment
Patch sum totalhours