From bbeece9e031f54198927db58cfcce2673fed317b Mon Sep 17 00:00:00 2001 From: Abdalhamid Alhamad Date: Sun, 26 Oct 2025 13:14:35 +0300 Subject: [PATCH] git checkout -b ZOD-349-weekly-spending-data-not-displaying-in-the-child-profile-parent-view --- src/card/services/transaction.service.ts | 4 ++-- src/junior/services/junior.service.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/card/services/transaction.service.ts b/src/card/services/transaction.service.ts index c45501a..1ac0134 100644 --- a/src/card/services/transaction.service.ts +++ b/src/card/services/transaction.service.ts @@ -85,8 +85,8 @@ export class TransactionService { } async getWeeklySummary(juniorId: string) { - const startOfWeek = moment().startOf('week').toDate(); - const endOfWeek = moment().endOf('week').toDate(); + const endOfWeek = moment().toDate(); + const startOfWeek = moment().subtract(1, 'week').toDate(); const transactions = await this.transactionRepository.getTransactionsForCardWithinDateRange( juniorId, diff --git a/src/junior/services/junior.service.ts b/src/junior/services/junior.service.ts index 1d266ec..9f3647c 100644 --- a/src/junior/services/junior.service.ts +++ b/src/junior/services/junior.service.ts @@ -212,8 +212,8 @@ export class JuniorService { this.logger.log(`Junior ${juniorId} deleted successfully`); } - getWeeklySummary(juniorId: string, guardianId: string) { - const doesBelong = this.doesJuniorBelongToGuardian(guardianId, juniorId); + async getWeeklySummary(juniorId: string, guardianId: string) { + const doesBelong = await this.doesJuniorBelongToGuardian(guardianId, juniorId); if (!doesBelong) { this.logger.error(`Junior ${juniorId} does not belong to guardian ${guardianId}`);