-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove summary row from charts, when rollup used #17412
Conversation
(Standard links)
|
@bhahumanists can you fix the style issue? https://test.civicrm.org/job/CiviCRM-Core-PR/34249/checkstyleResult/new/ |
Damn, I missed this. Can we run again to see the style issue? Amazed I've managed to mess up 3 lines :-) I'll sort |
You can type "jenkins test this please" and it will rerun the tests. |
In case it disappears again, it says
i.e. line 777 isn't actually a completely blank line and has some spaces in it. |
jenkins test this please |
@bhahumanists Can you please squash your commits so that this is ready to merge? |
@yashodha yes you're right jut I was actually just reviewing this just now and don't think this is the right fix. So @bhahumanists maybe hold off for a bit. |
Hi,
|
@bhahumanists - I take back what I said about the pie chart. I was confused. The patch fixes the pie chart too. I also think it's going to be hard to fix properly higher up, or to return the group-by columns in the select. Especially if the report were to support grouping by more than one rollup field (at the moment it only does it for date). So rather than hold this up I'm going to suggest the following variation instead, which then at least doesn't affect the hooks and later functions: --- a/CRM/Report/Form/Contribute/Summary.php
+++ b/CRM/Report/Form/Contribute/Summary.php
@@ -766,7 +766,7 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form {
*
* @param array $rows
*/
- public function buildChart(&$rows) {
+ public function buildChart(&$original_rows) {
$graphRows = [];
if (!empty($this->_params['charts'])) {
@@ -775,6 +775,14 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form {
$contrib = !empty($this->_params['fields']['total_amount']);
$softContrib = !empty($this->_params['fields']['soft_amount']);
+ // Make a copy so that we don't affect what gets passed later to hooks etc.
+ $rows = $original_rows;
+ if ($this->_rollup) {
+ // Remove the total row otherwise it overwrites the real last month's data since it has the
+ // same date.
+ array_pop($rows);
+ }
+
foreach ($rows as $key => $row) {
if ($row['civicrm_contribution_receive_date_subtotal']) {
$graphRows['receive_date'][] = $row['civicrm_contribution_receive_date_start']; Unless someone sees a better way. |
I have updated this based on @demeritcowboy 's suggestion and squashed commits adding MOP |
Issue: https://lab.civicrm.org/dev/report/-/issues/40
Overview
Graphs on the Contribution Summary report will include the grand total in some circumstances. This makes the final column or wedge incorrect.
Before
Graphs on the Contribution Summary report include the summary row, when rollup is used.
After
Graphs on the Contribution Summary report do not include the grand total, when rollup is used.
Technical Details
If the PR involves technical details/changes/considerations which would not be manifest to a casual developer skimming the above sections, please describe the details here.
Comments
Anything else you would like the reviewer to note