Use private methods

This commit is contained in:
Matt Jankowski 2025-06-25 13:49:59 -04:00
parent bfdaa9789a
commit 6fb6b9fa4b

View File

@ -8,8 +8,24 @@ class TagRelationshipsPresenter
@following_map = {}
@featuring_map = {}
else
@following_map = TagFollow.select(:tag_id).where(tag_id: tags.map(&:id), account_id: current_account_id).each_with_object({}) { |f, h| h[f.tag_id] = true }
@featuring_map = FeaturedTag.select(:tag_id).where(tag_id: tags.map(&:id), account_id: current_account_id).each_with_object({}) { |f, h| h[f.tag_id] = true }
@following_map = mapped_tag_follows(tags, current_account_id)
@featuring_map = mapped_featured_tags(tags, current_account_id)
end
end
private
def mapped_tag_follows(tags, account_id)
TagFollow
.where(tag_id: tags.map(&:id), account_id: account_id)
.pluck(:tag_id)
.index_with(true)
end
def mapped_featured_tags(tags, account_id)
FeaturedTag
.where(tag_id: tags.map(&:id), account_id: account_id)
.pluck(:tag_id)
.index_with(true)
end
end