Closed CarlosQ96 closed 4 months ago
The recent updates focus on enhancing the donation tracking and project statistics functionalities. Specifically, the donationService
now includes a condition to sum matchingFundPriceUsd
from the qfRoundHistory
table when calculating totalDonations
for a project. Simultaneously, projectService
has been streamlined to directly assign the result of sumDonationValueUsd
to project.sumDonationValueUsd
, removing redundant calculations.
Files | Change Summary |
---|---|
src/services/donationService.ts |
Updated updateTotalDonationsOfProject to include matchingFundPriceUsd from qfRoundHistory table. |
src/services/projectService.ts |
Simplified updateProjectStatistics by directly using sumDonationValueUsd for project.sumDonationValueUsd . |
sequenceDiagram
participant Project
participant DonationService
participant QfRoundHistory
Note over DonationService: Old Flow
Project->>DonationService: updateTotalDonationsOfProject(projectId)
DonationService->>QfRoundHistory: getMatchingFundPriceUsd(projectId)
QfRoundHistory-->>DonationService: matchingFundPriceUsd
DonationService-->>Project: totalDonations
Note over DonationService: New Flow
Project->>DonationService: updateTotalDonationsOfProject(projectId)
DonationService->>QfRoundHistory: getMatchingFundPriceUsd(projectId)
QfRoundHistory-->>DonationService: matchingFundPriceUsd
DonationService-->>Project: totalDonations (includes matchingFundPriceUsd)
sequenceDiagram
participant Project
participant ProjectService
participant DonationService
Note over ProjectService: Old Flow
Project->>ProjectService: updateProjectStatistics(projectId)
ProjectService->>DonationService: getQfRoundHistoryMatchingValueUsd(projectId)
DonationService-->>ProjectService: matchingValueUsd
ProjectService->>Project: project.sumDonationValueUsd = matchingValueUsd
Note over ProjectService: New Flow
Project->>ProjectService: updateProjectStatistics(projectId)
ProjectService->>DonationService: sumDonationValueUsd(projectId)
DonationService-->>ProjectService: sumDonationValueUsd
ProjectService->>Project: project.sumDonationValueUsd = sumDonationValueUsd
In code's bright dance, a change so grand,
Donations tallied across the land.
With matching funds now in the mix,
Projects thrive, no need for tricks.
Statistics streamlined, clear and bright,
Our code now shines, a guiding light.
🐇✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Summary by CodeRabbit