починка пагинации

This commit is contained in:
Arsen Mirzaev Tatyano-Muradovich 2023-06-23 00:05:08 +07:00
parent bcb58b7a78
commit 5686a3aec2

View File

@ -13,7 +13,6 @@ use ArangoDBClient\Document as _document,
// Фреймворк для Viber API // Фреймворк для Viber API
use Viber\Bot, use Viber\Bot,
Viber\Api\Sender, Viber\Api\Sender,
Viber\Api\Event,
Viber\Api\Keyboard, Viber\Api\Keyboard,
Viber\Api\Keyboard\Button, Viber\Api\Keyboard\Button,
Viber\Api\Message\Contact, Viber\Api\Message\Contact,
@ -184,7 +183,7 @@ function requests(int $amount = 5, int $page = 1): Cursor
$arangodb->session, $arangodb->session,
[ [
'query' => sprintf( 'query' => sprintf(
"FOR d IN works FILTER d.confirmed != 'да' SORT d.created DESC LIMIT %d, %d RETURN d", "FOR d IN works FILTER d.worker == null && d.confirmed != 'да' SORT d.created DESC LIMIT %d, %d RETURN d",
$offset, $offset,
$amount + $offset $amount + $offset
), ),
@ -284,7 +283,7 @@ try {
$count = $requests->getCount(); $count = $requests->getCount();
// Проверка существования избытка // Проверка существования избытка
$excess = $count === 6; $excess = $count % 6 === 0;
// Обрезка заявок до размера страницы // Обрезка заявок до размера страницы
$requests = array_slice($requests->getAll(), 0, 5); $requests = array_slice($requests->getAll(), 0, 5);