mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
code order & comment
This commit is contained in:
parent
592e16e260
commit
9ed00edc52
@ -54,11 +54,6 @@ export class BalanceResolver {
|
||||
},
|
||||
})
|
||||
|
||||
const transactionLinkRepository = getCustomRepository(TransactionLinkRepository)
|
||||
const { sumHoldAvailableAmount } = context.sumHoldAvailableAmount
|
||||
? { sumHoldAvailableAmount: context.sumHoldAvailableAmount }
|
||||
: await transactionLinkRepository.summary(user.id, now)
|
||||
|
||||
// The decay is always calculated on the last booked transaction
|
||||
const calculatedDecay = calculateDecay(
|
||||
lastTransaction.balance,
|
||||
@ -66,6 +61,12 @@ export class BalanceResolver {
|
||||
now,
|
||||
)
|
||||
|
||||
// The final balance is reduced by the link amount withheld
|
||||
const transactionLinkRepository = getCustomRepository(TransactionLinkRepository)
|
||||
const { sumHoldAvailableAmount } = context.sumHoldAvailableAmount
|
||||
? { sumHoldAvailableAmount: context.sumHoldAvailableAmount }
|
||||
: await transactionLinkRepository.summary(user.id, now)
|
||||
|
||||
return new Balance({
|
||||
balance: calculatedDecay.balance
|
||||
.minus(sumHoldAvailableAmount.toString())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user