FIX: summary email popular posts ordering by score, and increase minimum score to qualify as popular

This commit is contained in:
Neil Lalonde 2016-12-07 12:40:44 -05:00
parent d379f57c58
commit ad5d16af8e

View File

@ -136,11 +136,11 @@ class UserNotifications < ActionMailer::Base
@other_new_for_you = topics_for_digest.size > SiteSetting.digest_topics ? topics_for_digest[SiteSetting.digest_topics..-1] : [] @other_new_for_you = topics_for_digest.size > SiteSetting.digest_topics ? topics_for_digest[SiteSetting.digest_topics..-1] : []
@popular_posts = if SiteSetting.digest_posts > 0 @popular_posts = if SiteSetting.digest_posts > 0
Post.for_mailing_list(user, min_date) Post.order("posts.score DESC")
.for_mailing_list(user, min_date)
.where('posts.post_type = ?', Post.types[:regular]) .where('posts.post_type = ?', Post.types[:regular])
.where('posts.deleted_at IS NULL AND posts.hidden = false AND posts.user_deleted = false') .where('posts.deleted_at IS NULL AND posts.hidden = false AND posts.user_deleted = false')
.where("posts.post_number > ? AND posts.score > ?", 1, 5.0) .where("posts.post_number > ? AND posts.score > ?", 1, ScoreCalculator.default_score_weights[:like_score] * 5.0)
.order("posts.score DESC")
.limit(SiteSetting.digest_posts) .limit(SiteSetting.digest_posts)
else else
[] []