allow reportbooru to update post counts
This commit is contained in:
@@ -16,6 +16,7 @@ class RelatedTagsController < ApplicationController
|
|||||||
@tag = Tag.find_by_name(params[:name])
|
@tag = Tag.find_by_name(params[:name])
|
||||||
@tag.related_tags = params[:related_tags]
|
@tag.related_tags = params[:related_tags]
|
||||||
@tag.related_tags_updated_at = Time.now
|
@tag.related_tags_updated_at = Time.now
|
||||||
|
@tag.post_count = params[:post_count] if params[:post_count].present?
|
||||||
@tag.save
|
@tag.save
|
||||||
head :ok
|
head :ok
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -814,6 +814,7 @@ class Tag < ApplicationRecord
|
|||||||
self.related_tags = RelatedTagCalculator.calculate_from_sample_to_array(name).join(" ")
|
self.related_tags = RelatedTagCalculator.calculate_from_sample_to_array(name).join(" ")
|
||||||
end
|
end
|
||||||
self.related_tags_updated_at = Time.now
|
self.related_tags_updated_at = Time.now
|
||||||
|
fix_post_count if rand(post_count) <= 1
|
||||||
save
|
save
|
||||||
rescue ActiveRecord::StatementInvalid
|
rescue ActiveRecord::StatementInvalid
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user