Page MenuHomePhabricator

Refactor CampaignMonitorPerDay Report
Open, Needs TriagePublic

Description

NOTE: This is a technical subticket of {328075}

This ticket is about changing the "Campaign Monitor per Day" 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 CampaignMonitorPerDay does a lot what should be done with SQL GROUP BY and aggregation functions (SUM, COUNT). getDonationCountAndAmount should be rewritten to use a Doctrine DBAL connection to build the result data structure from a database result with aggregated data instead of getDonations and counting individual donations. Remove the Report inheritance and rewrite getDonations as as query builder.

Adapt the test to inject a fake version of the DBAL that returns the aggregated data and change the newCampaignMonitorPerDay factory function to create a proper instance of the class, injecting a mocked DBAL.