CRM-16719: stats fixes
authorKurund Jalmi <kurund@yahoo.com>
Mon, 17 Aug 2015 05:24:00 +0000 (10:54 +0530)
committerKurund Jalmi <kurund@yahoo.com>
Wed, 19 Aug 2015 17:45:58 +0000 (23:15 +0530)
CRM/Report/Form/ActivitySummary.php

index dd9caf11ab98251c03ebf75509b64135869f9795..b851dbd7d9fcfcef97be8957f2734beba615c911 100644 (file)
@@ -460,15 +460,15 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form {
 
     $actSQL = "SELECT
       COUNT(DISTINCT {$this->_aliases['civicrm_activity']}.activity_type_id ) as civicrm_activity_activity_type_id_count,
-      COUNT({$this->_aliases['civicrm_activity']}.activity_type_id ) as civicrm_activity_activity_type_count,
+      COUNT(DISTINCT {$this->_aliases['civicrm_activity']}.id ) as civicrm_activity_activity_id_count,
       SUM({$this->_aliases['civicrm_activity']}.duration ) as civicrm_activity_activity_duration
-      {$this->_from} {$this->_where}";
+      {$this->_from} {$this->_where} {$this->_groupBy}";
 
     $actDAO = CRM_Core_DAO::executeQuery($actSQL);
 
     while ($actDAO->fetch()) {
       $totalType += $actDAO->civicrm_activity_activity_type_id_count;
-      $totalActivity += $actDAO->civicrm_activity_activity_type_count;
+      $totalActivity += $actDAO->civicrm_activity_activity_id_count;
       $totalDuration += $actDAO->civicrm_activity_activity_duration;
     }