Ticket #7703 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

Totals not accurate when values are not integers

Reported by: danielnfi Assigned to: robguttman
Priority: normal Component: SumFieldsPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

If the numbers for a given column are not integers (say they are floats) the sum field will be incorrect.

Patch file with suggested fix is attached

Attachments

patch.diff (0.5 kB) - added by danielnfi on 09/20/10 21:07:49.

Change History

09/20/10 21:07:49 changed by danielnfi

  • attachment patch.diff added.

09/20/10 21:08:48 changed by danielnfi

--- templates/sumfields.html (revision 8998) +++ templates/sumfields.html (working copy) @@ -%ld,%ld +%ld,%ld @@

// sum up each row jQuery('.${field}', this).each(function(){

- var num = parseInt($(this).text()); + var num = parseFloat($(this).text());

if (!isNaN(num)){

sums${field}? += num;

}

09/20/10 21:09:10 changed by danielnfi

--- templates/sumfields.html    (revision 8998)
+++ templates/sumfields.html    (working copy)
@@ -%ld,%ld +%ld,%ld @@
             
             // sum up each row
             jQuery('.${field}', this).each(function(){
-                var num = parseInt($(this).text());
+                var num = parseFloat($(this).text());
                 if (!isNaN(num)){
                     sums['${field}'] += num;
                 }

11/20/10 21:30:43 changed by robguttman

(In [9475]) refs #7703: now handles float values. thanks to danielnfi for his patch.

11/20/10 21:31:19 changed by robguttman

  • status changed from new to closed.
  • resolution set to fixed.

Add/Change #7703 (Totals not accurate when values are not integers)




Change Properties
Action