about summary refs log tree commit diff
path: root/app/models/trends/statuses.rb
diff options
context:
space:
mode:
authorNick Schonning <nschonni@gmail.com>2023-02-18 17:09:40 -0500
committerGitHub <noreply@github.com>2023-02-19 07:09:40 +0900
commit2177daeae92b77be6797ba8f2ab6ebe1e641e078 (patch)
tree2cf004cd1611bd53f21cdb8021e98aa499448627 /app/models/trends/statuses.rb
parent167709f6b0731c163619c58afcb0ca11bb393e54 (diff)
Autofix Rubocop Style/RedundantBegin (#23703)
Diffstat (limited to 'app/models/trends/statuses.rb')
-rw-r--r--app/models/trends/statuses.rb26
1 files changed, 11 insertions, 15 deletions
diff --git a/app/models/trends/statuses.rb b/app/models/trends/statuses.rb
index c9ef7c8f2..84bff9c02 100644
--- a/app/models/trends/statuses.rb
+++ b/app/models/trends/statuses.rb
@@ -99,21 +99,17 @@ class Trends::Statuses < Trends::Base
       expected  = 1.0
       observed  = (status.reblogs_count + status.favourites_count).to_f
 
-      score = begin
-        if expected > observed || observed < options[:threshold]
-          0
-        else
-          ((observed - expected)**2) / expected
-        end
-      end
-
-      decaying_score = begin
-        if score.zero? || !eligible?(status)
-          0
-        else
-          score * (0.5**((at_time.to_f - status.created_at.to_f) / options[:score_halflife].to_f))
-        end
-      end
+      score = if expected > observed || observed < options[:threshold]
+                0
+              else
+                ((observed - expected)**2) / expected
+              end
+
+      decaying_score = if score.zero? || !eligible?(status)
+                         0
+                       else
+                         score * (0.5**((at_time.to_f - status.created_at.to_f) / options[:score_halflife].to_f))
+                       end
 
       [decaying_score, status]
     end