Merge pull request #1838 from gradido/fix-confirm-creation

fix: Confirm Creation with Decimal
This commit is contained in:
Moriz Wahl 2022-04-26 15:04:05 +02:00 committed by GitHub
commit 387ce34390
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 6 deletions

View File

@ -14,7 +14,7 @@
"dev": "cross-env TZ=UTC nodemon -w src --ext ts --exec ts-node -r tsconfig-paths/register src/index.ts",
"lint": "eslint --max-warnings=0 --ext .js,.ts .",
"test": "cross-env TZ=UTC NODE_ENV=development jest --runInBand --coverage --forceExit --detectOpenHandles",
"seed": "cross-env TZ=UTC ts-node -r tsconfig-paths/register src/seeds/index.ts"
"seed": "cross-env TZ=UTC NODE_ENV=development ts-node -r tsconfig-paths/register src/seeds/index.ts"
},
"dependencies": {
"@types/jest": "^27.0.2",

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!

View File

@ -38,7 +38,7 @@ KLICKTIPP_PASSWORD=
KLICKTIPP_APIKEY_DE=
KLICKTIPP_APIKEY_EN=
EMAIL=true
EMAIL=false
EMAIL_USERNAME=peter@lustig.de
EMAIL_SENDER=peter@lustig.de
EMAIL_PASSWORD=1234