fix: Confirm Creation with Decimal

This commit is contained in:
Moriz Wahl 2022-04-26 09:27:55 +02:00
parent 7f9f564497
commit 6d48b6f4e3
2 changed files with 3 additions and 4 deletions

View File

@ -333,8 +333,7 @@ export class AdminResolver {
decay = calculateDecay(lastTransaction.balance, lastTransaction.balanceDate, receivedCallDate)
newBalance = decay.balance
}
// TODO pending creations decimal
newBalance = newBalance.add(new Decimal(Number(pendingCreation.amount)).toString())
newBalance = newBalance.add(pendingCreation.amount.toString())
const transaction = new DbTransaction()
transaction.typeId = TransactionTypeId.CREATION
@ -516,7 +515,7 @@ function isCreationValid(creations: Decimal[], amount: Decimal, creationDate: Da
throw new Error(`No Creation found!`)
}
if (amount.greaterThan(creations[index])) {
if (amount.greaterThan(creations[index].toString())) {
throw new Error(
`The amount (${amount} GDD) to be created exceeds the available amount (${creations[index]} GDD) for this month.`,
)

View File

@ -86,7 +86,7 @@ export const createTransactionLink = gql`
export const createPendingCreation = gql`
mutation (
$email: String!
$amount: Float!
$amount: Decimal!
$memo: String!
$creationDate: String!
$moderator: Int!