fix(repositories): make db queries use count

This should fix /about page
This commit is contained in:
Alexander Minkin 2023-12-10 21:55:28 +03:00
parent b2b6fe6966
commit 88d296a9c4
Signed by untrusted user: WerySkok
GPG key ID: 88E9A2F3AFE44C30
3 changed files with 5 additions and 5 deletions

View file

@ -53,7 +53,7 @@ class Clubs
function getCount(): int
{
return sizeof(clone $this->clubs);
return (clone $this->clubs)->count('*');
}
function getPopularClubs(): \Traversable

View file

@ -252,6 +252,6 @@ class Posts
function getCount(): int
{
return sizeof(clone $this->posts);
return (clone $this->posts)->count('*');
}
}

View file

@ -142,9 +142,9 @@ class Users
function getStatistics(): object
{
return (object) [
"all" => sizeof(clone $this->users),
"active" => sizeof((clone $this->users)->where("online > 0")),
"online" => sizeof((clone $this->users)->where("online >= ?", time() - 900)),
"all" => (clone $this->users)->count('*'),
"active" => (clone $this->users)->where("online > 0")->count('*'),
"online" => (clone $this->users)->where("online >= ?", time() - 900)->count('*'),
];
}