mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Adding decay calculation to the creation.
This commit is contained in:
parent
40dff50364
commit
cb3c600216
@ -16,6 +16,7 @@ import { TransactionCreation } from '@entity/TransactionCreation'
|
||||
import { UserTransaction } from '@entity/UserTransaction'
|
||||
import { UserTransactionRepository } from '../../typeorm/repository/UserTransaction'
|
||||
import { BalanceRepository } from '../../typeorm/repository/Balance'
|
||||
import { calculateDecay } from '../../util/decay'
|
||||
|
||||
@Resolver()
|
||||
export class AdminResolver {
|
||||
@ -174,7 +175,11 @@ export class AdminResolver {
|
||||
if (!lastUserTransaction) {
|
||||
newBalance = 0
|
||||
} else {
|
||||
newBalance = lastUserTransaction.balance
|
||||
newBalance = await calculateDecay(
|
||||
lastUserTransaction.balance,
|
||||
lastUserTransaction.balanceDate,
|
||||
new Date(),
|
||||
)
|
||||
}
|
||||
newBalance = Number(newBalance) + Number(parseInt(pendingCreation.amount.toString()))
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user