Skip to content
Extraits de code Groupes Projets
Valider a7f149e3 rédigé par Raphael Sofaer's avatar Raphael Sofaer
Parcourir les fichiers

Possible performance gain from not hitting posts relation

parent 00cca370
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -26,7 +26,7 @@ class ApplicationController < ActionController::Base ...@@ -26,7 +26,7 @@ class ApplicationController < ActionController::Base
if user_signed_in? if user_signed_in?
@aspect = nil @aspect = nil
@object_aspect_ids = [] @object_aspect_ids = []
@all_aspects = current_user.aspects.includes(:aspect_memberships) @all_aspects = current_user.aspects.includes(:aspect_memberships, :post_visibilities)
@notification_count = Notification.for(current_user, :unread =>true).count @notification_count = Notification.for(current_user, :unread =>true).count
@user_id = current_user.id @user_id = current_user.id
end end
......
...@@ -22,13 +22,13 @@ module ApplicationHelper ...@@ -22,13 +22,13 @@ module ApplicationHelper
def aspects_with_post aspects, post def aspects_with_post aspects, post
aspects.select do |aspect| aspects.select do |aspect|
aspect.post_ids.include?(post.id) aspect.post_visibilities.detect{|pv| pv.post_id == post.id}
end end
end end
def aspects_without_post aspects, post def aspects_without_post aspects, post
aspects.reject do |aspect| aspects.reject do |aspect|
aspect.post_ids.include?(post.id) aspect.post_visibilities.detect{|pv| pv.post_id == post.id}
end end
end end
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter