fix gifts pagination (#984)

This commit is contained in:
lalka2018 2023-09-18 18:09:25 +03:00 committed by GitHub
parent 43de40a0dc
commit cc5a56917b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View file

@ -42,4 +42,10 @@ class Gifts
foreach($cats as $cat) foreach($cats as $cat)
yield new GiftCategory($cat); yield new GiftCategory($cat);
} }
function getCategoriesCount(): int
{
$cats = $this->cats->where("deleted", false);
return $cats->count();
}
} }

View file

@ -41,6 +41,7 @@ final class GiftsPresenter extends OpenVKPresenter
$this->template->user = $user; $this->template->user = $user;
$this->template->iterator = $cats; $this->template->iterator = $cats;
$this->template->count = $this->gifts->getCategoriesCount();
$this->template->_template = "Gifts/Menu.xml"; $this->template->_template = "Gifts/Menu.xml";
} }