Proper ordering

This commit is contained in:
Jason Zimdars
2024-09-13 09:52:55 -05:00
parent 5c72be49dd
commit 3cf841d463
3 changed files with 7 additions and 3 deletions
+3 -1
View File
@@ -5,8 +5,10 @@ class BubblesController < ApplicationController
if params[:tag_id]
@tag = Tag.find(params[:tag_id])
@bubbles = @tag.bubbles
@most_active_bubbles = @tag.bubbles.left_joins(:comments, :boosts).group(:id).order(Arel.sql('COUNT(comments.id) + COUNT(boosts.id) DESC')).limit(10)
else
@bubbles = Bubble.all
@bubbles = Bubble.all.order(created_at: :desc)
@most_active_bubbles = Bubble.left_joins(:comments, :boosts).group(:id).order(Arel.sql('COUNT(comments.id) + COUNT(boosts.id) DESC')).limit(10)
end
end
+3 -1
View File
@@ -26,7 +26,9 @@
<% end %>
<section class="windshield flex-inline flex-wrap gap-half justify-center align-end">
<%= render @bubbles.last(10) %>
<% cache([@most_active_bubbles, 'stable_shuffle']) do %>
<%= render @most_active_bubbles.sort_by { |bubble| Digest::MD5.hexdigest("#{bubble.id}#{@most_active_bubbles.cache_key}") } %>
<% end %>
</section>
<section class="bubbles-list unpad-inline center margin-block-start">
+1 -1
View File
@@ -28,7 +28,7 @@ Rails.application.configure do
"Cache-Control" => "public, max-age=#{2.days.to_i}"
}
else
config.action_controller.perform_caching = false
config.action_controller.perform_caching = true
config.cache_store = :null_store
end