From 37ccbce7ea83e12fd435d7981cc1c87984fe8df2 Mon Sep 17 00:00:00 2001
From: Edsel <edsel.lopez@jmaconsulting.biz>
Date: Wed, 9 Sep 2015 18:02:45 +0530
Subject: [PATCH 1/2] NRM-4 Modified count for total engagement rate

---
 CRM/Yoteup/Form/Report/ManagementSummary.php | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/CRM/Yoteup/Form/Report/ManagementSummary.php b/CRM/Yoteup/Form/Report/ManagementSummary.php
index c9e9139..f17ea64 100644
--- a/CRM/Yoteup/Form/Report/ManagementSummary.php
+++ b/CRM/Yoteup/Form/Report/ManagementSummary.php
@@ -84,9 +84,8 @@ class CRM_Yoteup_Form_Report_ManagementSummary extends CRM_Report_Form {
        UNION
        SELECT 'Percent engagement rate for site' as description,
        CONCAT_WS(ROUND((SUM(perday_completed)/SUM(DISTINCT(perday_start)))*100, 2), '', '%') as perday_visitor_count FROM
-       ( SELECT COUNT(DISTINCT(nid)) as perday_completed
-       FROM {$this->_drupalDatabase}.webform_submissions WHERE (1) {$urlSubWhere}
-       GROUP BY nid, remote_addr) as h
+       ( SELECT COUNT(DISTINCT(location)) as perday_completed
+       FROM {$this->_drupalDatabase}.watchdog WHERE (1) {$urlWhere}) as h
        INNER JOIN
        (SELECT COUNT(DISTINCT((SUBSTRING_INDEX(SUBSTRING_INDEX(location, '://', -1), '/', 1)))) as perday_start 
        FROM {$this->_drupalDatabase}.watchdog) as i";
-- 
GitLab


From d22349457a7163464a472b8701cb0f2e97cfbf50 Mon Sep 17 00:00:00 2001
From: Edsel <edsel.lopez@jmaconsulting.biz>
Date: Wed, 9 Sep 2015 18:40:32 +0530
Subject: [PATCH 2/2] NRM-3 Modified group concat operation

---
 CRM/Yoteup/Form/Report/IndividualCounseller.php | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/CRM/Yoteup/Form/Report/IndividualCounseller.php b/CRM/Yoteup/Form/Report/IndividualCounseller.php
index 31dd422..68f638d 100644
--- a/CRM/Yoteup/Form/Report/IndividualCounseller.php
+++ b/CRM/Yoteup/Form/Report/IndividualCounseller.php
@@ -339,14 +339,12 @@ class CRM_Yoteup_Form_Report_IndividualCounseller extends CRM_Report_Form {
     $dao = CRM_Core_DAO::executeQuery($sql);
 
     $sql = "CREATE TEMPORARY TABLE civicrm_watchdog_temp_c AS
-      SELECT cc.id, MAX(ws.sid), GROUP_CONCAT(wsd22.data, ' ', wsd23.data, ' ', wsd24.data) as brochures
+      SELECT cc.id, MAX(ws.sid), GROUP_CONCAT(wsd22.data SEPARATOR ', ') as brochures
       FROM civicrm_contact cc
       LEFT JOIN {$this->_drupalDatabase}.webform_submitted_data wsd ON wsd.data = cc.id AND wsd.cid = 2
-      LEFT JOIN {$this->_drupalDatabase}.webform_submitted_data wsd22 ON wsd22.cid = 22 AND wsd22.sid = wsd.sid
-      LEFT JOIN {$this->_drupalDatabase}.webform_submitted_data wsd23 ON wsd23.cid = 23 AND wsd23.sid = wsd.sid
-      LEFT JOIN {$this->_drupalDatabase}.webform_submitted_data wsd24 ON wsd24.cid = 24 AND wsd24.sid = wsd.sid
+      LEFT JOIN {$this->_drupalDatabase}.webform_submitted_data wsd22 ON wsd22.cid IN (22,23,24) AND wsd22.sid = wsd.sid
       LEFT JOIN {$this->_drupalDatabase}.webform_submissions ws ON ws.sid = wsd.sid
-      WHERE ws.nid = 72
+      WHERE ws.nid = 72 AND wsd.data IS NOT NULL
       GROUP BY cc.id";
     $dao = CRM_Core_DAO::executeQuery($sql);
   }
-- 
GitLab