From e67b724058f0e29b64a06285e1348801e15374bf Mon Sep 17 00:00:00 2001 From: Hannes Heine Date: Wed, 24 Nov 2021 16:08:01 +0100 Subject: [PATCH] Calculate the usedAmount with the pending amounts. --- 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 92dc46ef8..08b0f2b48 100644 --- a/backend/src/graphql/resolver/AdminResolver.ts +++ b/backend/src/graphql/resolver/AdminResolver.ts @@ -125,13 +125,13 @@ async function getUserCreations(id: number): Promise { // COUNT amount from 2 tables // if amount < 3000 => Store in pending_creations - const usedCreationBeforeLastMonth = Number(createdAmountBeforeLastMonth.sum) + Number() - const usedCreationLastMonth = Number(createdAmountLastMonth.sum) + Number() - const usedCreationMonth = Number(createdAmountMonth.sum) + Number() + const usedCreationBeforeLastMonth = Number(createdAmountBeforeLastMonth.sum) + Number(pendingAmountBeforeLastMounth.sum) + const usedCreationLastMonth = Number(createdAmountLastMonth.sum) + Number(pendingAmountLastMounth.sum) + const usedCreationMonth = Number(createdAmountMonth.sum) + Number(pendingAmountMounth.sum) return [ - 10000000 - usedCreationBeforeLastMonth, - 10000000 - usedCreationLastMonth, - 10000000 - usedCreationMonth, + ( 10000000 - usedCreationBeforeLastMonth ) / 1000, + ( 10000000 - usedCreationLastMonth ) / 1000, + ( 10000000 - usedCreationMonth ) / 1000, ] }