Pull out Bubble#activity_count

This commit is contained in:
Jose Farias
2024-10-28 10:07:12 -06:00
parent e8eb5ac243
commit 8b062b4432
2 changed files with 5 additions and 2 deletions
+1 -2
View File
@@ -8,9 +8,8 @@ module BubblesHelper
end
def bubble_size(bubble)
activity = bubble.boost_count + bubble.messages.comments.size
rank =
case activity
case bubble.activity_count
when 0..5 then "one"
when 6..10 then "two"
when 11..25 then "three"
+4
View File
@@ -48,6 +48,10 @@ class Bubble < ApplicationRecord
end
end
def activity_count
boost_count + messages.comments.size
end
private
def set_default_title
self.title = title.presence || "Untitled"