Skip to content
Snippets Groups Projects
Commit 65e9c0b0 authored by Yassine Doghri's avatar Yassine Doghri
Browse files

fix(housekeeping): use EpisodeModel's builder to reset comments count

parent 0c0730be
No related branches found
No related tags found
No related merge requests found
......@@ -337,16 +337,14 @@ class EpisodeModel extends Model
public function resetCommentsCount(): int | false
{
$episodeCommentsBuilder = $this->builder();
$episodeCommentsCount = $episodeCommentsBuilder->select('episodes.id, COUNT(*) as `comments_count`')
$episodeCommentsCount = $this->builder()
->select('episodes.id, COUNT(*) as `comments_count`')
->join('episode_comments', 'episodes.id = episode_comments.episode_id')
->where('in_reply_to_id', null)
->groupBy('episodes.id')
->getCompiledSelect();
$postModel = new PostModel();
$episodePostsRepliesBuilder = $postModel->builder();
$episodePostsRepliesCount = $episodePostsRepliesBuilder
$episodePostsRepliesCount = $this->builder()
->select('episodes.id, COUNT(*) as `comments_count`')
->join(
config('Fediverse')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment