Opened 6 years ago

Last modified 6 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 Rochi)

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).


So the cast have to look like

CAST( newvalue AS DECIMAL(10,2))

I've attached a patch.

Attachments (1) (1.8 KB) - added by Rochi 6 years ago.
Patch sum totalhours

Download all attachments as: .zip

Change History (7)

Changed 6 years ago by Rochi

Attachment: added

Patch sum totalhours

comment:1 Changed 6 years ago by Rochi

Description: modified (diff)

comment:2 Changed 6 years ago by Russ Tyndall

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:3 Changed 6 years ago by Russ Tyndall

In 17096:

Fix hour summing in reports to not round partial hours

version 1.5.8(b)

re #13405

comment:4 Changed 6 years ago by Rochi

Never mind. But please apply my patch (see attached patch) also to to fix the issue in the ticket view.

comment:5 Changed 6 years ago by Russ Tyndall

Sorry, I missed that -- it does make me wonder how I have never hit this bug.

I will apply a patch in a moment

comment:6 Changed 6 years ago by Russ Tyndall

In 17107:

1.5.9(b) - fixed Decimal cast in ticket_daemon re #13405

Modify Ticket

Change Properties
Set your email in Preferences
as new The owner will remain Russ Tyndall.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.