Commit 6f8a1c01 authored by mgabdev's avatar mgabdev

Fixed issue in PopularLinksController with top links

• Fixed:
- issue in PopularLinksController with top links
parent 68e27c07
......@@ -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')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment