From 8b062b4432e951936caa6d2534a4be944e83fb53 Mon Sep 17 00:00:00 2001 From: Jose Farias Date: Mon, 28 Oct 2024 10:07:12 -0600 Subject: [PATCH] Pull out `Bubble#activity_count` --- app/helpers/bubbles_helper.rb | 3 +-- app/models/bubble.rb | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/helpers/bubbles_helper.rb b/app/helpers/bubbles_helper.rb index 12c833415..a88cadc30 100644 --- a/app/helpers/bubbles_helper.rb +++ b/app/helpers/bubbles_helper.rb @@ -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" diff --git a/app/models/bubble.rb b/app/models/bubble.rb index 4c0cd24f7..15aef3a3c 100644 --- a/app/models/bubble.rb +++ b/app/models/bubble.rb @@ -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"