[Vtigercrm-commits] [vtiger-commits] r10706 - /vtigercrm/branches/5.0.3/modules/Reports/ReportRun.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Tue Apr 17 08:19:18 EDT 2007


Author: richie
Date: Tue Apr 17 06:19:12 2007
New Revision: 10706

Log:
* Fixed the issue in average because of null values ie., to get average we will use AVG function in MySQL. when we use this NULL values will not be taken to get the average so that we have used sum()/count() to get average instead of avg(), Fixed #3566

Modified:
    vtigercrm/branches/5.0.3/modules/Reports/ReportRun.php

Modified: vtigercrm/branches/5.0.3/modules/Reports/ReportRun.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Reports/ReportRun.php (original)
+++ vtigercrm/branches/5.0.3/modules/Reports/ReportRun.php Tue Apr 17 06:19:12 2007
@@ -2011,7 +2011,9 @@
 				}
 				if($fieldlist[4] == 3)
 				{
-					$stdfilterlist[$fieldcolname] = "avg(".$fieldlist[1].".".$fieldlist[2].") '".$fieldlist[3]."'";
+					//Fixed average calculation issue due to NULL values ie., when we use avg() function, NULL values will be ignored.to avoid this we use (sum/count) to find average.
+					//$stdfilterlist[$fieldcolname] = "avg(".$fieldlist[1].".".$fieldlist[2].") '".$fieldlist[3]."'";
+					$stdfilterlist[$fieldcolname] = "(sum(".$fieldlist[1].".".$fieldlist[2].")/count(*)) '".$fieldlist[3]."'";
 				}
 				if($fieldlist[4] == 4)
 				{





More information about the vtigercrm-commits mailing list