implement KISS on transaction list length - first page contains 26 instead of 25 transactions now due to virtual decay transaction

This commit is contained in:
Ulf Gebhardt 2022-03-04 12:41:10 +01:00
parent 3af5ee13b9
commit 29b1d44cdd
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9

View File

@ -80,13 +80,12 @@ export class TransactionResolver {
}
// find transactions
const limit = currentPage === 1 && order === Order.DESC ? pageSize - 1 : pageSize
const offset =
currentPage === 1 ? 0 : (currentPage - 1) * pageSize - (order === Order.DESC ? 1 : 0)
// first page can contain 26 due to virtual decay transaction
const offset = (currentPage - 1) * pageSize
const transactionRepository = getCustomRepository(TransactionRepository)
const [userTransactions, userTransactionsCount] = await transactionRepository.findByUserPaged(
user.id,
limit,
pageSize,
offset,
order,
onlyCreations,