Fixed issue in PopularLinksController with top links

• Fixed:
- issue in PopularLinksController with top links
This commit is contained in:
mgabdev 2020-11-09 14:29:34 -06:00
parent 68e27c07d7
commit 6f8a1c012d

View File

@ -34,7 +34,7 @@ class Api::V1::PopularLinksController < Api::BaseController
statusIds = Status.where('statuses.created_at > ?', 24.hours.ago)
.joins(:status_stat)
.order('status_stats.favourites_count DESC')
.where('status_stats.favourites_count > 1')
.where('status_stats.favourites_count > 15')
.joins("LEFT JOIN preview_cards_statuses ON statuses.id = preview_cards_statuses.status_id")
.where('preview_cards_statuses.status_id IS NOT NULL')
.limit(100)
@ -43,7 +43,7 @@ class Api::V1::PopularLinksController < Api::BaseController
cards = PreviewCard.joins("LEFT JOIN preview_cards_statuses ON preview_cards.id = preview_cards_statuses.preview_card_id")
.where('preview_cards_statuses.preview_card_id IS NOT NULL')
.where('preview_cards_statuses.status_id IN (?)', statusIds)
.having('COUNT(preview_cards_statuses.preview_card_id) > 1')
.having('COUNT(preview_cards_statuses.preview_card_id) > 2')
.where('preview_cards.updated_at > ?', 24.hours.ago)
.order('COUNT(preview_cards_statuses.preview_card_id) DESC')
.group('preview_cards.id')