tweak styles for intro page

This commit is contained in:
r888888888
2013-06-24 15:32:17 -07:00
parent 90e90e8be2
commit 3bc4c886c3
5 changed files with 34 additions and 21 deletions

View File

@@ -1,6 +1,6 @@
class IntroPresenter
def popular_tags
Tag.order("post_count desc").limit(8).map(&:name)
Tag.where("category in (3, 4)").order("post_count desc").limit(8).map(&:name)
end
def each

View File

@@ -23,25 +23,7 @@ module PostSetPresenters
end
def popular_tags
Cache.get("popular-tags", 1.hour) do
CurrentUser.scoped(User.admins.first, "127.0.0.1") do
n = 1
results = []
while results.empty? && n < 256
query = n.days.ago.strftime("date:>%Y-%m-%d")
results = RelatedTagCalculator.calculate_from_sample_to_array(query)
n *= 2
end
results.map! do |tag_name, recent_count|
tag = Tag.find_or_create_by_name(tag_name)
[tag_name, recent_count.to_f / tag.post_count.to_f]
end
results.sort_by! {|x| -x[1]}.map(&:first)
end
end
Tag.trending
end
def pattern_tags