mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
decay only with first page, ensure that the limit is kept
This commit is contained in:
parent
999a49c41f
commit
4a68dd3c7a
@ -333,16 +333,27 @@ class AppRequestsController extends AppController
|
||||
$this->addAdminError('StateBalancesController', 'overview', $gdtEntries, $user['id'] ? $user['id'] : 0);
|
||||
}
|
||||
|
||||
$limit = $count;
|
||||
$offset = 0;
|
||||
if($page == 1) {
|
||||
$limit--;
|
||||
} else {
|
||||
$offset = (( $page - 1 ) * $count) - 1;
|
||||
}
|
||||
|
||||
$stateUserTransactionsQuery = $stateUserTransactionsTable
|
||||
->find()
|
||||
->where(['state_user_id' => $user['id']])
|
||||
->order(['balance_date' => $orderDirection])
|
||||
->contain([])
|
||||
->limit($count)
|
||||
->page($page)
|
||||
->limit($limit)
|
||||
//->page($page)
|
||||
->offset($offset)
|
||||
;
|
||||
$decay = true;
|
||||
if($page > 1) {
|
||||
$decay = false;
|
||||
}
|
||||
$transactions = [];
|
||||
$transactions_from_db = $stateUserTransactionsQuery->toArray();
|
||||
|
||||
|
||||
@ -185,7 +185,7 @@ class TransactionsTable extends Table
|
||||
if($i > 0 ) {
|
||||
$prev = $stateUserTransactions[$i-1];
|
||||
}
|
||||
if($prev && $decay == true)
|
||||
if($prev)
|
||||
{
|
||||
if($prev->balance > 0) {
|
||||
$current = $su_transaction;
|
||||
@ -252,7 +252,7 @@ class TransactionsTable extends Table
|
||||
|
||||
$final_transactions[] = $final_transaction;
|
||||
|
||||
if($i == $stateUserTransactionsCount-1 && $decay == true) {
|
||||
if($i == $stateUserTransactionsCount-1 && $decay) {
|
||||
$now = new FrozenTime();
|
||||
$calculated_decay = $stateBalancesTable->calculateDecay(
|
||||
$su_transaction->balance,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user