This ticket is about changing the "Campaign Monitor per Hour" report to query the database for donations with matching campaign and keywords instead of iterating over donations and checking the tracking data in PHP.
Affected repositories
- Fundraising Operation Center
Implementation Details:
The PHP code of CampaignMonitorPerHour does a lot what should be done with SQL GROUP BY and aggregation functions (SUM, COUNT). Replace the GetDonationsTrait with a Doctrine DBAL instance and a query to build the result data structure from a database result with aggregated data instead of getDonations and counting individual donations.
Adapt the test to inject a fake version of the DBAL that returns the aggregated data and change the newCampaignMonitorPerHour factory function to create a proper instance of the class, injecting a mocked DBAL.