add tag correction support

This commit is contained in:
albert
2013-03-17 23:03:02 -04:00
parent 6cb85fcfdf
commit c6a814ce3f
8 changed files with 46 additions and 5 deletions

View File

@@ -587,6 +587,15 @@ class Post < ActiveRecord::Base
end
module CountMethods
def fix_post_counts
post.set_tag_counts
post.update_column(:tag_count, post.tag_count)
post.update_column(:tag_count_general, post.tag_count_general)
post.update_column(:tag_count_artist, post.tag_count_artist)
post.update_column(:tag_count_copyright, post.tag_count_copyright)
post.update_column(:tag_count_character, post.tag_count_character)
end
def get_count_from_cache(tags)
count = Cache.get(count_cache_key(tags))

View File

@@ -41,8 +41,12 @@ class Tag < ActiveRecord::Base
end
end
def real_post_count
Post.raw_tag_match(name).count
end
def fix_post_count
update_column(:post_count, Post.raw_tag_match(name).count)
update_column(:post_count, real_post_count)
end
end