From d56322a0ddbf16e710aae49fb2d0494f3986995e Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 12 Mar 2024 00:13:20 +0000 Subject: [PATCH] Consistently exclude hidden diaries from spam scoring --- app/models/user.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 7ed7c249f..45ecbcc1b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -360,9 +360,9 @@ class User < ApplicationRecord diary_comment_score = diary_comments.visible.inject(0) { |acc, elem| acc + elem.body.spam_score } score = description.spam_score / 4.0 - score += diary_entries.where("created_at > ?", 1.day.ago).count * 10 - score += diary_entry_score / diary_entries.length unless diary_entries.empty? - score += diary_comment_score / diary_comments.length unless diary_comments.empty? + score += diary_entries.visible.where("created_at > ?", 1.day.ago).count * 10 + score += diary_entry_score / diary_entries.visible.length unless diary_entries.visible.empty? + score += diary_comment_score / diary_comments.visible.length unless diary_comments.visible.empty? score -= changeset_score score -= trace_score -- 2.39.5