1 # frozen_string_literal: true
10 changeset_score = user.changesets.size * 50
11 trace_score = user.traces.size * 50
12 diary_entry_score = user.diary_entries.visible.inject(0) { |acc, elem| acc + SpamScorer.new_from_rich_text(elem.body).score }
13 diary_comment_score = user.diary_comments.visible.inject(0) { |acc, elem| acc + SpamScorer.new_from_rich_text(elem.body).score }
14 report_score = Report.where(:category => "spam", :issue => user.issues.with_status("open")).distinct.count(:user_id) * 20
16 score = SpamScorer.new_from_rich_text(user.description).score / 4.0
17 score += user.diary_entries.visible.where("created_at > ?", 1.day.ago).count * 10
18 score += diary_entry_score / user.diary_entries.visible.length unless user.diary_entries.visible.empty?
19 score += diary_comment_score / user.diary_comments.visible.length unless user.diary_comments.visible.empty?
21 score -= changeset_score