Skip to content
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

dev/core#1673 Ensure that SQL statements are not duplicated in the de… #17001

Merged
merged 1 commit into from
Apr 7, 2020

Conversation

seamuslee001
Copy link
Contributor

…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

@civibot
Copy link

civibot bot commented Apr 6, 2020

(Standard links)

@eileenmcnaughton
Copy link
Contributor

OK - I'm happy to go with this based on your analysis - I had noticed the double ups & the impact of a mistake in this area is minimal

@seamuslee001 seamuslee001 merged commit 0f8ba10 into civicrm:master Apr 7, 2020
@seamuslee001 seamuslee001 deleted the dev_core_1673 branch April 7, 2020 01:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants