add tag correction support
This commit is contained in:
@@ -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))
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user