Skip to content

Commit

Permalink
also pass dirction to vote amount
Browse files Browse the repository at this point in the history
  • Loading branch information
leafo committed Jan 7, 2017
1 parent cf434a5 commit d28bac2
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion community/models/community_users.lua
Expand Up @@ -21,7 +21,7 @@ do
timestamp = false
})
end,
get_vote_score = function(self, object)
get_vote_score = function(self, object, positive)
return 1
end,
count_vote_for = function(self, object)
Expand Down
2 changes: 1 addition & 1 deletion community/models/community_users.moon
Expand Up @@ -82,7 +82,7 @@ class CommunityUsers extends Model
}, timestamp: false

-- how much do their votes count for, an override point
get_vote_score: (object) => 1
get_vote_score: (object, positive) => 1

count_vote_for: (object) =>
object.user_id != @user_id
Expand Down
2 changes: 1 addition & 1 deletion community/models/votes.lua
Expand Up @@ -181,7 +181,7 @@ do
positive = not not positive,
ip = self:current_ip_address(),
counted = cu:count_vote_for(object),
score = cu:get_vote_score(object)
score = cu:get_vote_score(object, positive)
}
local action, vote = upsert(self, params)
if action == "update" and old_vote then
Expand Down
2 changes: 1 addition & 1 deletion community/models/votes.moon
Expand Up @@ -76,7 +76,7 @@ class Votes extends Model
positive: not not positive
ip: @current_ip_address!
counted: cu\count_vote_for object
score: cu\get_vote_score object
score: cu\get_vote_score object, positive
}

action, vote = upsert @, params
Expand Down

0 comments on commit d28bac2

Please sign in to comment.