dev/core#1673 Ensure that SQL statements are not duplicated in the de… #17001
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…veloper tab of reports
Overview
This ensures that the formatted SQL only contains unique SQL statements rather than duplicated ones.
Before
Load up the contribution summary report and check the developer tab and note that one of the 2 SQLs is printed twice on the developer tab
After
Correct number of SQL statements are rendered
Technical Details
The problem is that you have 2 form variables
$this->sqlArray and $this->sqlFormattedArray and the issue is that when it is first called both are empty. So the buildQuery SQL is added to both correctly. The 2nd time it gets called from within the statistics function in the contribuiton summary report. The sqlArray already has the build report query in it so it gets looped in again when we do the foreach loop so gets re-formated again and re-added to the sqlformattedArray variable. This fixes it by resetting the sqlFormattedArray variable before the foreach
ping @eileenmcnaughton @monishdeb