From 91089c66682c867afe928d0913b5a2c67beff0b6 Mon Sep 17 00:00:00 2001 From: Hannes Heine Date: Wed, 24 Nov 2021 14:46:56 +0100 Subject: [PATCH] Change the result value to the sum value. --- backend/src/graphql/resolver/AdminResolver.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/src/graphql/resolver/AdminResolver.ts b/backend/src/graphql/resolver/AdminResolver.ts index 8e0d2b3b4..377a1c8a6 100644 --- a/backend/src/graphql/resolver/AdminResolver.ts +++ b/backend/src/graphql/resolver/AdminResolver.ts @@ -55,8 +55,8 @@ async function getUserCreations(id: number): Promise { .andWhere({ targetDate: Raw((alias) => `${alias} >= :date and ${alias} < :enddate`, { date: "2021-09-01", enddate: "2021-10-01" /* TODO: NOW().format("YYYY-MM") + '-01' - 2 Month */ }) }) - .getOne() - console.log('createdAmountBeforeLastMonth', createdAmountBeforeLastMonth) + .getRawOne() + console.log('createdAmountBeforeLastMonth.sum', createdAmountBeforeLastMonth.sum) const createdAmountLastMonth = await getCustomRepository(TransactionCreationRepository) .createQueryBuilder('transaction_creations') @@ -65,8 +65,8 @@ async function getUserCreations(id: number): Promise { .andWhere({ targetDate: Raw((alias) => `${alias} >= :date and ${alias} < :enddate`, { date: "2021-10-01", enddate: "2021-11-01" /* TODO: NOW().format("YYYY-MM") + '-01' - 2 Month */ }) }) - .getOne() - console.log('createdAmountLastMonth', createdAmountLastMonth) + .getRawOne() + console.log('createdAmountLastMonth.sum', createdAmountLastMonth.sum) const createdAmountMonth = await getCustomRepository(TransactionCreationRepository) .createQueryBuilder('transaction_creations') @@ -75,8 +75,8 @@ async function getUserCreations(id: number): Promise { .andWhere({ targetDate: Raw((alias) => `${alias} >= :date and ${alias} < :enddate`, { date: "2021-11-01", enddate: "2021-12-01" /* TODO: NOW().format("YYYY-MM") + '-01' - 2 Month */ }) }) - .getOne() - console.log('createdAmountMonth', createdAmountMonth) + .getRawOne() + console.log('createdAmountMonth.sum', createdAmountMonth.sum) // const transactionCreationsMonthQuery = await findAllUserTransactionCreations.andWhere({ // targetDate: Raw((alias) => `${alias} > :date and ${alias} < :enddate`, { date: "2021-11-01", enddate: "2021-12-01" /* TODO: NOW().format("YYYY-MM") + '-01' - 2 Month */ })