fix: Improve performance of most hit APIs in widget (#11089)
- Cache campaigns for better performance - Fix N+1 queries in inbox members - Remove unused related articles
This commit is contained in:
@@ -4,26 +4,6 @@ json.locale category.locale
|
||||
json.description category.description
|
||||
json.position category.position
|
||||
|
||||
json.related_categories do
|
||||
if category.related_categories.any?
|
||||
json.array! category.related_categories.each do |related_category|
|
||||
json.partial! partial: 'public/api/v1/models/associated_category', formats: [:json], category: related_category
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if category.parent_category.present?
|
||||
json.parent_category do
|
||||
json.partial! partial: 'public/api/v1/models/associated_category', formats: [:json], category: category.parent_category
|
||||
end
|
||||
end
|
||||
|
||||
if category.root_category.present?
|
||||
json.root_category do
|
||||
json.partial! partial: 'public/api/v1/models/associated_category', formats: [:json], category: category.root_category
|
||||
end
|
||||
end
|
||||
|
||||
json.meta do
|
||||
json.articles_count category.articles.published.size
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user