move vote similarity code into danbooru, add listing for super voters
This commit is contained in:
@@ -12,6 +12,18 @@ class PostVote < ActiveRecord::Base
|
||||
where("created_at < ?", 30.days.ago).delete_all
|
||||
end
|
||||
|
||||
def self.positive_user_ids
|
||||
select_values_sql("select user_id from post_votes where score > 0 group by user_id having count(*) > 100")
|
||||
end
|
||||
|
||||
def self.negative_post_ids(user_id)
|
||||
select_values_sql("select post_id from post_votes where score < 0 and user_id = ?", user_id)
|
||||
end
|
||||
|
||||
def self.positive_post_ids(user_id)
|
||||
select_values_sql("select post_id from post_votes where score > 0 and user_id = ?", user_id)
|
||||
end
|
||||
|
||||
def score=(x)
|
||||
if x == "up"
|
||||
Post.where(:id => post_id).update_all("score = score + #{magnitude}, up_score = up_score + #{magnitude}")
|
||||
|
||||
Reference in New Issue
Block a user