reduce tag sub post limit

This commit is contained in:
albert
2013-03-12 12:39:16 -04:00
parent 687a775fdf
commit 2d39404b66

View File

@@ -43,8 +43,9 @@ class TagSubscription < ActiveRecord::Base
end
def process
divisor = [tag_query_array.size / 2, 1].max
post_ids = tag_query_array.inject([]) do |all, tag|
all += Post.tag_match(tag).limit(Danbooru.config.tag_subscription_post_limit / 3).select("posts.id").order("posts.id DESC").map(&:id)
all += Post.tag_match(tag).limit(Danbooru.config.tag_subscription_post_limit / divisor).select("posts.id").order("posts.id DESC").map(&:id)
end
self.post_ids = post_ids.sort.reverse.slice(0, Danbooru.config.tag_subscription_post_limit).join(",")
end