app/models/spam_report.rb
def score_user(user)
    new_works = []
    ips = []
    score = 0
    works = user.works.
                 visible_to_registered_user.
                 where("works.created_at > ?", new_date)
    works.each do |work|
      unless work.spam_checked?
        work.check_for_spam
      end

      if work.created_at > new_date
        new_works << work.id
        ips << work.ip_address
        if work.spam?
          score += 4
        else
          score += 1
        end
      end
    end

    count = user.works.
                 where("works.created_at > ? AND works.created_at < ?",
                       recent_date,
                       new_date).
                 posted.not_spam.count
    score -= (count * 2)
    score += ips.uniq.length
    [new_works, score]
  end
# Scoring rules:
# For every new spam work, add 4 to the score
# For every new non-spam work, add 1
# For every older non-spam work,
# decrease the score by 2
# Add the number of different ip addresses used to post
Scoring rules:
For every new spam work, add 4 to the score
For every new non-spam work, add 1
For every older non-spam work,
decrease the score by 2
Add the number of different ip addresses used to post
Scoring rules : For every new spam work add 4 to the score For every new non - spam work add 1 For every older non - spam work decrease the score by 2 Add the number of different ip addresses used to post
def score_user(user)
    new_works = []
    ips = []
    score = 0
    works = user.works.
                 visible_to_registered_user.
                 where("works.created_at > ?", new_date)
    works.each do |work|
      unless work.spam_checked?
        work.check_for_spam
      end
      if work.created_at > new_date
        new_works << work.id
        ips << work.ip_address
        if work.spam?
          score += 4
        else
          score += 1
        end
      end
    end
    count = user.works.
                 where("works.created_at > ? AND works.created_at < ?",
                       recent_date,
                       new_date).
                 posted.not_spam.count
    score -= (count * 2)
    score += ips.uniq.length
    [new_works, score]
  end
def score_user ( user ) new_works = [ ] ips = [ ] score = 0 works = user . works . visible_to_registered_user . where ( "works.created_at > ?" , new_date ) works . each do | work | unless work . spam_checked? work . check_for_spam end if work . created_at > new_date new_works << work . id ips << work . ip_address if work . spam? score += 4 else score += 1 end end end count = user . works . where ( "works.created_at > ? AND works.created_at < ?" , recent_date , new_date ) . posted . not_spam . count score -= ( count * 2 ) score += ips . uniq . length [ new_works , score ] end
Scoring rules:
For every new spam work, add 4 to the score
For every new non-spam work, add 1
For every older non-spam work,
decrease the score by 2
Add the number of different ip addresses used to post
Scoring rules : For every new spam work add 4 to the score For every new non - spam work add 1 For every older non - spam work decrease the score by 2 Add the number of different ip addresses used to post
user