use forEach instead of for loop in transactions,

simplified code
This commit is contained in:
Ulf Gebhardt 2022-03-04 12:51:30 +01:00
parent e69437cb9f
commit ca3c07b0d8
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9

View File

@ -119,16 +119,13 @@ export class TransactionResolver {
}
// transactions
for (let i = 0; i < userTransactions.length; i++) {
const userTransaction = userTransactions[i]
let linkedUser = null
if (userTransaction.typeId === TransactionTypeId.CREATION) {
linkedUser = communityUser
} else {
linkedUser = involvedUsers.find((u) => u.id === userTransaction.linkedUserId)
}
userTransactions.forEach((userTransaction) => {
const linkedUser =
userTransaction.typeId === TransactionTypeId.CREATION
? communityUser
: involvedUsers.find((u) => u.id === userTransaction.linkedUserId)
transactions.push(new Transaction(userTransaction, self, linkedUser))
}
})
// Construct Result
return new TransactionList(