Merge pull request #3786 from consul/obsolete_method

Remove obsolete method to recalculate counter
This commit is contained in:
Javier Martín
2019-10-23 00:24:42 +02:00
committed by GitHub
2 changed files with 0 additions and 26 deletions

View File

@@ -63,12 +63,6 @@ module ActsAsTaggableOn
Tag.decrement_counter(custom_counter_field_name_for(taggable_type), id)
end
def recalculate_custom_counter_for(taggable_type)
visible_taggables = taggable_type.constantize.includes(:taggings).where("taggings.taggable_type" => taggable_type, "taggings.tag_id" => id)
update(custom_counter_field_name_for(taggable_type) => visible_taggables.count)
end
def self.category_names
Tag.category.pluck(:name)
end

View File

@@ -45,26 +45,6 @@ describe ActsAsTaggableOn do
end
describe "Tag" do
describe "#recalculate_custom_counter_for" do
it "updates the counters of proposals and debates, taking into account hidden ones" do
tag = Tag.create(name: "foo")
create(:proposal, tag_list: "foo")
create(:proposal, :hidden, tag_list: "foo")
create(:debate, tag_list: "foo")
create(:debate, :hidden, tag_list: "foo")
tag.update(debates_count: 0, proposals_count: 0)
tag.recalculate_custom_counter_for("Debate")
expect(tag.debates_count).to eq(1)
tag.recalculate_custom_counter_for("Proposal")
expect(tag.proposals_count).to eq(1)
end
end
describe "public_for_api scope" do
it "returns tags whose kind is NULL and have at least one tagging whose taggable is not hidden" do