]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/user.rb
Merge remote-tracking branch 'upstream/pull/5741'
[rails.git] / app / models / user.rb
index 21fe2181b20abe9bfce7b196699d6fc368aca722..a63846e421f917044560852bb3c07ded3ed00649 100644 (file)
@@ -3,7 +3,7 @@
 # Table name: users
 #
 #  email                :string           not null
-#  id                   :bigint(8)        not null, primary key
+#  id                   :bigint           not null, primary key
 #  pass_crypt           :string           not null
 #  creation_time        :datetime         not null
 #  display_name         :string           default(""), not null
@@ -28,7 +28,7 @@
 #  diary_entries_count  :integer          default(0), not null
 #  image_use_gravatar   :boolean          default(FALSE), not null
 #  auth_provider        :string
-#  home_tile            :bigint(8)
+#  home_tile            :bigint
 #  tou_agreed           :datetime
 #  diary_comments_count :integer          default(0)
 #  note_comments_count  :integer          default(0)
@@ -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