Fix sorted_tags_for_cloud: it's now using the cloud_view_count

This commit is contained in:
chris 2013-07-19 01:52:36 +08:00
parent 3a91c92bf7
commit f025c98ffa
2 changed files with 1 additions and 25 deletions

View File

@ -140,7 +140,7 @@ class ModuleApp
def sorted_tags_for_cloud def sorted_tags_for_cloud
temp_tags = {} temp_tags = {}
self.tags.each{ |tag| self.tags.each{ |tag|
temp_tags.merge!({tag => Tag.get_impressionist(tag)}) temp_tags.merge!({tag => tag.cloud_view_count})
} }
if !temp_tags.blank? if !temp_tags.blank?
sorted_tags = temp_tags.sort{|a,b| a[1]<=>b[1]}.reverse sorted_tags = temp_tags.sort{|a,b| a[1]<=>b[1]}.reverse

View File

@ -17,30 +17,6 @@ class Tag
belongs_to :module_tag, polymorphic: true belongs_to :module_tag, polymorphic: true
has_many :taggings, dependent: :destroy has_many :taggings, dependent: :destroy
#field :cloud_amper,:type: Integer,:default=> 0
# def self.sorted_for_cloud
# tags = {}
# self.all.each{ |tag|
# tags.merge!({tag => self.get_impressionist(tag)})
# }
# if !tags.blank?
# sorted_tags = tags.sort{|a,b| a[1]<=>b[1]}.reverse
# sorted_tags[0][1] = :hot1
# offset = (sorted_tags.size - 1) / 3
# i = 1
# class_i = 2
# sorted_tags[1..-1].collect!{ |x|
# x[1] = "hot#{class_i}"
# i == offset ? i = 1 : i += 1 if class_i < 4
# class_i += 1 if i == offset && class_i < 4
# }
# sorted_tags
# else
# []
# end
# end
protected protected
def self.get_impressionist(item_tag = self) def self.get_impressionist(item_tag = self)