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);
|
$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
|
$stateUserTransactionsQuery = $stateUserTransactionsTable
|
||||||
->find()
|
->find()
|
||||||
->where(['state_user_id' => $user['id']])
|
->where(['state_user_id' => $user['id']])
|
||||||
->order(['balance_date' => $orderDirection])
|
->order(['balance_date' => $orderDirection])
|
||||||
->contain([])
|
->contain([])
|
||||||
->limit($count)
|
->limit($limit)
|
||||||
->page($page)
|
//->page($page)
|
||||||
|
->offset($offset)
|
||||||
;
|
;
|
||||||
$decay = true;
|
$decay = true;
|
||||||
|
if($page > 1) {
|
||||||
|
$decay = false;
|
||||||
|
}
|
||||||
$transactions = [];
|
$transactions = [];
|
||||||
$transactions_from_db = $stateUserTransactionsQuery->toArray();
|
$transactions_from_db = $stateUserTransactionsQuery->toArray();
|
||||||
|
|
||||||
|
|||||||
@ -185,7 +185,7 @@ class TransactionsTable extends Table
|
|||||||
if($i > 0 ) {
|
if($i > 0 ) {
|
||||||
$prev = $stateUserTransactions[$i-1];
|
$prev = $stateUserTransactions[$i-1];
|
||||||
}
|
}
|
||||||
if($prev && $decay == true)
|
if($prev)
|
||||||
{
|
{
|
||||||
if($prev->balance > 0) {
|
if($prev->balance > 0) {
|
||||||
$current = $su_transaction;
|
$current = $su_transaction;
|
||||||
@ -252,7 +252,7 @@ class TransactionsTable extends Table
|
|||||||
|
|
||||||
$final_transactions[] = $final_transaction;
|
$final_transactions[] = $final_transaction;
|
||||||
|
|
||||||
if($i == $stateUserTransactionsCount-1 && $decay == true) {
|
if($i == $stateUserTransactionsCount-1 && $decay) {
|
||||||
$now = new FrozenTime();
|
$now = new FrozenTime();
|
||||||
$calculated_decay = $stateBalancesTable->calculateDecay(
|
$calculated_decay = $stateBalancesTable->calculateDecay(
|
||||||
$su_transaction->balance,
|
$su_transaction->balance,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user