compucorp / uk.co.compucorp.civicrm.pivotreport

CiviCRM Pivot table reporting solution
Other
8 stars 13 forks source link

Entities Missing From Reports #108

Closed vinuvarshith closed 6 years ago

vinuvarshith commented 6 years ago

Overview

In a site with a lot of cases, a good number of them were missing on the pivot reports.

Issue

On looking into the code, when entities are cached, the path column (unique path name for cache element) is not unique in few cases. The main part of this 'path' is $index which is usually the a 'date' like ('start date' for cases, 'date received' for contributions etc). So I guess if a number of cases are added with same start date for example, they are overwritten in cache table and so missing from reports.

Possible Resolution

Adding entity ID as part of 'path' to make it unique fixes the issue

tunbola commented 6 years ago

@vinuvarshith, the index is actually used to group similar data with same date together in the civicrm_pivotreportcache table so that it will be faster and easier to search related data by the index. This change will mean that there will be a single row for each record in the table rather than rows that group the data together by the related index. Also note here https://github.com/compucorp/uk.co.compucorp.civicrm.pivotreport/blob/c163ea93a359b5411ccd8286af5ea92b9900532f/CRM/PivotCache/AbstractGroup.php#L167 and here https://github.com/compucorp/uk.co.compucorp.civicrm.pivotreport/blob/c976e07d2fd40ef0a7f61bc22a3c93c73544c0f9/CRM/PivotCache/GroupActivity.php#L20 That the extension regenerates the path when searching for data using the date here. This might cause problem also as the path it would generate is now different since the index now has IDs appended to it.