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