-
-
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
Readability cleanup on EventIncome report (towards bringing it under testing) #13963
Conversation
(Standard links)
|
14ddb0f
to
388f185
Compare
388f185
to
83c2e29
Compare
test this please |
1 similar comment
test this please |
CRM/Report/Form/Event/Income.php
Outdated
$activeParticipantStatuses = []; | ||
foreach (CRM_Event_PseudoConstant::participantStatus(NULL, "is_counted = 1", "label") as $id => $label) { | ||
$activeParticipantStatuses[$id] = $label; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not $activeParticipantStatuses = CRM_Event_PseudoConstant::participantStatus(NULL, "is_counted = 1", "label");
or return CRM_Event_PseudoConstant::participantStatus(NULL, "is_counted = 1", "label");
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @pradpnayak on looking into it your suggestions make sense & improve readability - I have updated the PR
CRM/Report/Form/Event/Income.php
Outdated
@@ -216,6 +208,7 @@ public function buildEventReport($eventIDs) { | |||
|
|||
$statusDAO = $this->executeReportQuery($status); | |||
|
|||
$participantStatus = CRM_Event_PseudoConstant::participantStatus(NULL, "is_counted = 1", "label"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about using $participantStatus = $this->getActiveParticipantStatuses();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated per below
83c2e29
to
27f4227
Compare
Looks good now. Good to merge! |
Merging as per Pradeep's review |
Overview
Minor readability cleanup, preparatory to extracting buildQuery & bringing it under testing
Before
Less readable
After
More readable
Technical Details
@lcdservices I took a look at this PR #13928 but didn't really feel comfortable making any functional changes to the report before we bring it under unit test - it's one of 3 reports specifically excluded :-(
The main thing we need to do is extract the code that generates $sql to be in a function called buildQuery that takes no arguments
In order to do that I felt some minor cleanup had to happen first - this is just getting the status stuff into a more extractable form.
I also noticed your PR is hard to read due to reformatting - we can fix the formatting in the cleanup PRs. Let me know if this seems good to you...
Comments