From 22e30186b113c824681d65f45edf1265b38e7841 Mon Sep 17 00:00:00 2001 From: Albert Yi Date: Wed, 5 Sep 2018 14:08:05 -0700 Subject: [PATCH] add min bound for post count fixing --- app/models/tag.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/tag.rb b/app/models/tag.rb index 891ce3db8..df31b9b4c 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -814,7 +814,7 @@ class Tag < ApplicationRecord self.related_tags = RelatedTagCalculator.calculate_from_sample_to_array(name).join(" ") end self.related_tags_updated_at = Time.now - fix_post_count if rand(post_count) <= 1 + fix_post_count if post_count > 20 && rand(post_count) <= 1 save rescue ActiveRecord::StatementInvalid end