Skip to content

Commit

Permalink
optim: use @neighborhood.number_of_root_chat_messages
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-entourage committed Jan 9, 2025
1 parent b77d786 commit 001688a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
4 changes: 0 additions & 4 deletions app/models/neighborhood.rb
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,6 @@ def display_address= display_address
self[:longitude] = google_place_details[:longitude]
end

def posts_count
posts.length
end

def outings_with_admin_online scope: :outings
scope = :outings unless [:past_outings, :future_outings, :ongoing_outings].include?(scope)

Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/neighborhoods/_edit_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<%= link_to "Événements (#{@neighborhood.outings.count})", show_outings_admin_neighborhood_path(@neighborhood) %>
</li>
<li role="presentation" class="<%= :active if tab == :show_posts %>">
<%= link_to "Publications (#{@neighborhood.posts_count})", show_posts_admin_neighborhood_path(@neighborhood) %>
<%= link_to "Publications (#{@neighborhood.number_of_root_chat_messages})", show_posts_admin_neighborhood_path(@neighborhood) %>
</li>

<% if tab == :show_outing_chat_messages || @outing.present? %>
Expand Down

0 comments on commit 001688a

Please sign in to comment.