Change the result value to the sum value.

This commit is contained in:
Hannes Heine 2021-11-24 14:46:56 +01:00 committed by ogerly
parent 3cd5ab27db
commit 91089c6668

View File

@ -55,8 +55,8 @@ async function getUserCreations(id: number): Promise<number[]> {
.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<number[]> {
.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<number[]> {
.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 */ })