diff --git a/src/repositories/recurringDonationRepository.ts b/src/repositories/recurringDonationRepository.ts index 7dec0dea1..d7b05cb99 100644 --- a/src/repositories/recurringDonationRepository.ts +++ b/src/repositories/recurringDonationRepository.ts @@ -106,7 +106,8 @@ export const updateRecurringDonationFromTheStreamDonations = async ( SELECT COALESCE(SUM(d."amount"), 0) FROM donation as d WHERE d."recurringDonationId" = $1 - ) + ), + "updatedAt" = NOW() WHERE "id" = $1 `, [recurringDonationId], diff --git a/src/services/recurringDonationService.ts b/src/services/recurringDonationService.ts index 647b187cd..b7381690c 100644 --- a/src/services/recurringDonationService.ts +++ b/src/services/recurringDonationService.ts @@ -529,13 +529,13 @@ export const recurringDonationsStreamedCUsdTotal = async ( ).select('COALESCE(SUM(recurringDonation.totalUsdStreamed), 0)', 'total'); if (fromDate) { - query.andWhere('recurringDonation.createdAt >= :fromDate', { + query.andWhere('recurringDonation.updatedAt >= :fromDate', { fromDate: new Date(fromDate), }); } if (toDate) { - query.andWhere('recurringDonation.createdAt <= :toDate', { + query.andWhere('recurringDonation.updatedAt <= :toDate', { toDate: new Date(toDate), }); } @@ -575,13 +575,13 @@ export const recurringDonationsStreamedCUsdTotalPerMonth = async ( .addSelect("TO_CHAR(recurringDonation.createdAt, 'YYYY/MM')", 'date'); if (fromDate) { - query.andWhere('recurringDonation.createdAt >= :fromDate', { + query.andWhere('recurringDonation.updatedAt >= :fromDate', { fromDate: new Date(fromDate), }); } if (toDate) { - query.andWhere('recurringDonation.createdAt <= :toDate', { + query.andWhere('recurringDonation.updatedAt <= :toDate', { toDate: new Date(toDate), }); } @@ -627,13 +627,13 @@ export const recurringDonationsTotalPerToken = async (params: { .having('SUM(recurringDonation.totalUsdStreamed) > 0'); if (fromDate) { - query.andWhere('recurringDonation.createdAt >= :fromDate', { + query.andWhere('recurringDonation.updatedAt >= :fromDate', { fromDate: new Date(fromDate), }); } if (toDate) { - query.andWhere('recurringDonation.createdAt <= :toDate', { + query.andWhere('recurringDonation.updatedAt <= :toDate', { toDate: new Date(toDate), }); }