]> git.openstreetmap.org Git - rails.git/commitdiff
Include the user description in the spam score
authorTom Hughes <tom@compton.nu>
Sat, 1 May 2010 10:22:37 +0000 (11:22 +0100)
committerTom Hughes <tom@compton.nu>
Thu, 6 May 2010 16:18:34 +0000 (17:18 +0100)
app/models/user.rb

index a76d45710a51ed4500124f63b9958e058e4eca8c..c6a9ad518729bb63147b8c0003131d9a57848116 100644 (file)
@@ -175,12 +175,12 @@ class User < ActiveRecord::Base
     diary_entry_score = self.diary_entries.inject(0) { |s,e| s += OSM.spam_score(e.body) }
     diary_comment_score = self.diary_comments.inject(0) { |s,e| s += OSM.spam_score(e.body) }
 
-    score = 0
+    score = OSM.spam_score(self.description) * 2
     score += diary_entry_score / self.diary_entries.length if self.diary_entries.length > 0
     score += diary_comment_score / self.diary_comments.length if self.diary_comments.length > 0
     score -= changeset_score
     score -= trace_score
 
-    return score
+    return score.to_i
   end
 end