Apply efficiency adjustment to orgs as well (#20710)
This commit is contained in:
parent
2ad8b7a809
commit
c901eb48be
1 changed files with 4 additions and 5 deletions
|
|
@ -13,8 +13,7 @@ module Organizations
|
|||
def suggest
|
||||
return [] if tags_to_consider.empty?
|
||||
|
||||
filtered_articles = Article.cached_tagged_with_any(tags_to_consider).where.not(organization_id: nil)
|
||||
org_ids = fetch_and_pluck_org_ids(filtered_articles)
|
||||
org_ids = fetch_and_pluck_org_ids
|
||||
Organization.where(id: org_ids.uniq).order(Arel.sql("RANDOM()")).limit(MAX)
|
||||
end
|
||||
|
||||
|
|
@ -26,9 +25,9 @@ module Organizations
|
|||
user.decorate.cached_followed_tag_names
|
||||
end
|
||||
|
||||
def fetch_and_pluck_org_ids(filtered_articles)
|
||||
order = Arel.sql("(hotness_score * (feed_success_score - clickbait_score)) DESC")
|
||||
filtered_articles.order(order).limit(MAX * 2).pluck(:organization_id)
|
||||
def fetch_and_pluck_org_ids
|
||||
Article.published.cached_tagged_with_any(tags_to_consider).where.not(organization_id: nil)
|
||||
.order("hotness_score DESC").limit(MAX * 2).pluck(:organization_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue