From: Tom Hughes Date: Sun, 16 Feb 2025 14:06:46 +0000 (+0000) Subject: Only count reports from distinct users in spam checks X-Git-Tag: live~183^2~1 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/a87cd780d6f37518e7e7ff19ec4027b3b1323518?ds=sidebyside;hp=-c Only count reports from distinct users in spam checks --- a87cd780d6f37518e7e7ff19ec4027b3b1323518 diff --git a/app/models/user.rb b/app/models/user.rb index 21fe2181b..8d061e26b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -359,7 +359,7 @@ class User < ApplicationRecord trace_score = traces.size * 50 diary_entry_score = diary_entries.visible.inject(0) { |acc, elem| acc + elem.body.spam_score } diary_comment_score = diary_comments.visible.inject(0) { |acc, elem| acc + elem.body.spam_score } - report_score = Report.where(:category => "spam", :issue => issues.with_status("open")).count * 20 + report_score = Report.where(:category => "spam", :issue => issues.with_status("open")).distinct.count(:user_id) * 20 score = description.spam_score / 4.0 score += diary_entries.visible.where("created_at > ?", 1.day.ago).count * 10