From 10c3fd2cf78c2a7822ba53152ecaca4930c09cd1 Mon Sep 17 00:00:00 2001 From: nicolas-entourage <75681929+nicolas-entourage@users.noreply.github.com> Date: Thu, 9 Jan 2025 14:09:18 +0100 Subject: [PATCH] EN-7917 use denorms to avoid n+1 --- app/views/admin/neighborhoods/show_outings.html.erb | 2 +- app/views/admin/neighborhoods/show_posts.html.erb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/admin/neighborhoods/show_outings.html.erb b/app/views/admin/neighborhoods/show_outings.html.erb index 60949e37c..609adcdb2 100644 --- a/app/views/admin/neighborhoods/show_outings.html.erb +++ b/app/views/admin/neighborhoods/show_outings.html.erb @@ -24,7 +24,7 @@ <%= image_tag(outing.image_url, size: '225x96') if outing.image_url.present? %> - <% if outing.parent_chat_messages.any? %> + <% if outing.number_of_root_chat_messages > 0 %>
<%= link_to "voir les messages", show_outing_posts_admin_neighborhood_path(@neighborhood, outing_id: outing.id) %>
<% end %> diff --git a/app/views/admin/neighborhoods/show_posts.html.erb b/app/views/admin/neighborhoods/show_posts.html.erb index 081645b63..6af0279a7 100644 --- a/app/views/admin/neighborhoods/show_posts.html.erb +++ b/app/views/admin/neighborhoods/show_posts.html.erb @@ -102,7 +102,7 @@ <% end %> - <% if message.children.any? %> + <% if message.comments_count > 0 %>
<%= link_to "voir les commentaires", show_post_comments_admin_neighborhood_path(@neighborhood, post_id: message.id) %>
<% end %> @@ -118,7 +118,7 @@ method: :post %> - <% unless message.children.any? %> + <% unless message.comments_count > 0 %>
  • <%= link_to "Ajouter un commentaire", show_post_comments_admin_neighborhood_path(@neighborhood, post_id: message.id) %>