From bcac9c405e3dd9ec420690c6db9fa84b6a5f7b98 Mon Sep 17 00:00:00 2001 From: Arsen Mirzaev Tatyano-Muradovich Date: Mon, 8 Apr 2024 09:08:42 +0700 Subject: [PATCH] =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=BD=D0=B0=20=D0=BD=D0=B0=D0=BB=D0=B8=D1=87=D0=B8?= =?UTF-8?q?=D0=B5=20=D1=81=D0=BE=D1=82=D1=80=D1=83=D0=B4=D0=BD=D0=B8=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=B2=20=D1=80=D0=B5=D0=B5=D1=81=D1=82=D1=80=D0=B5=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=B1=D0=BB=D0=BE=D0=BA=D0=B8=D1=80=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20=D0=B2=20=D0=BC=D0=B0=D0=B3?= =?UTF-8?q?=D0=B0=D0=B7=D0=B8=D0=BD=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../registry/requests/system/public/robot.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/mirzaev/spetsresurs/telegram/registry/requests/system/public/robot.php b/mirzaev/spetsresurs/telegram/registry/requests/system/public/robot.php index 24ccc50..9fad8c0 100755 --- a/mirzaev/spetsresurs/telegram/registry/requests/system/public/robot.php +++ b/mirzaev/spetsresurs/telegram/registry/requests/system/public/robot.php @@ -236,10 +236,11 @@ function generateMenu(Context $ctx): void * @param int $amount Количество * @param ?string $date За какую дату (unixtime) * @param int $page Страница + * @param _document $worker Сотрудник * * @return Cursor */ -function requests(int $amount = 5, ?string $date = null, int $page = 1): Cursor +function requests(int $amount = 5, ?string $date = null, int $page = 1, _document $worker): Cursor { global $arangodb; @@ -260,11 +261,12 @@ function requests(int $amount = 5, ?string $date = null, int $page = 1): Cursor [ 'query' => sprintf( // d.date < %s там специально, не менять на <= - "FOR d IN task FILTER ((d.date >= %s && d.date < %s && d.start >= '05:00') || (d.date >= %s && d.date < %s && d.start < '05:00')) && d.worker == null && d.market != null && d.confirmed != true && d.published == true && d.completed != true SORT d.created DESC, d._key DESC LIMIT %d, %d RETURN d", + "FOR d IN task FILTER ((d.date >= %s && d.date < %s && d.start >= '05:00') || (d.date >= %s && d.date < %s && d.start < '05:00')) && d.worker == null && d.market != null && d.confirmed != true && d.published == true && d.completed != true && (FOR m IN market FILTER m.id == d.market && IS_ARRAY(m.bans) SORT m.created DESC, m._key DESC LIMIT 1 RETURN !POSITION(m.bans, \"%s\"))[0] SORT d.created DESC, d._key DESC LIMIT %d, %d RETURN d", $from = (new DateTime("@$date"))->setTime(0, 0)->format('U'), $to = (new DateTime("@$date"))->modify('+1 day')->setTime(0, 0)->format('U'), $to, (new DateTime("@$date"))->modify('+2 day')->setTime(0, 0)->format('U'), + $worker->id, $offset, $amount + $offset - ($page > 0) ), @@ -459,7 +461,7 @@ function search(Context $ctx): void else { // Активен аккаунт - $ctx->getChatDataItem('requests_page')->then(function ($page) use ($ctx, $arangodb) { + $ctx->getChatDataItem('requests_page')->then(function ($page) use ($ctx, $arangodb, $worker) { // Найдена текущая страница // Значение страницы по умолчанию @@ -468,9 +470,9 @@ function search(Context $ctx): void $ctx->setChatDataItem('requests_page', 1); } - $generate = function ($date) use ($ctx, $page, $arangodb) { + $generate = function ($date) use ($ctx, $page, $arangodb, $worker) { // Поиск заявок в ArangoDB - $tasks = requests(4, (string) $date, $page); + $tasks = requests(4, (string) $date, $page, $worker); // Подсчёт количества прочитанных заявок из базы данных $count = $tasks->getCount();