diff --git a/app/models/tag.rb b/app/models/tag.rb index 2d3ad47c3..135bd3c46 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -56,10 +56,6 @@ class Tag < ApplicationRecord extend ActiveSupport::Concern module ClassMethods - def counts_for(tag_names) - select_all_sql("SELECT name, post_count FROM tags WHERE name IN (?)", tag_names) - end - def highest_post_count Cache.get("highest-post-count", 4.hours) do select("post_count").order("post_count DESC").first.post_count diff --git a/app/presenters/tag_set_presenter.rb b/app/presenters/tag_set_presenter.rb index b5cadc582..e8b499010 100644 --- a/app/presenters/tag_set_presenter.rb +++ b/app/presenters/tag_set_presenter.rb @@ -5,7 +5,8 @@ =end class TagSetPresenter < Presenter - attr_reader :tag_names, :tags + extend Memoist + attr_reader :tag_names def initialize(tag_names) @tag_names = tag_names @@ -13,9 +14,10 @@ class TagSetPresenter < Presenter def tag_list_html(current_query: "", show_extra_links: false, name_only: false) html = "" - if tag_names.present? + + if ordered_tags.present? html << '" @@ -28,7 +30,8 @@ class TagSetPresenter < Presenter html = "" category_list.each do |category| - typetags = typed_tags(category) + typetags = ordered_tags.select { |tag| tag.category == Tag.categories.value_for(category) } + if typetags.any? html << TagCategory.header_mapping[category] if headers html << %{