mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 10:01:40 -05:00
Correct base score calculation in vote.js
When we downvote an item or cancel one of its upvotes, we should decrese, not increase, the base score.
This commit is contained in:
parent
7bdc62d9b1
commit
9e4b152ec7
1 changed files with 2 additions and 2 deletions
|
@ -147,7 +147,7 @@ downvoteItem = function (collection, item, user) {
|
|||
addVote(user._id, vote, collectionName, 'down');
|
||||
|
||||
// extend item with baseScore to help calculate newScore
|
||||
item = _.extend(item, {baseScore: (item.baseScore + votePower)});
|
||||
item = _.extend(item, {baseScore: (item.baseScore - votePower)});
|
||||
updateScore({collection: collection, item: item, forceUpdate: true});
|
||||
|
||||
// if the item is being upvoted by its own author, don't give karma
|
||||
|
@ -201,7 +201,7 @@ cancelUpvote = function (collection, item, user) {
|
|||
removeVote(user._id, item._id, collectionName, 'up');
|
||||
|
||||
// extend item with baseScore to help calculate newScore
|
||||
item = _.extend(item, {baseScore: (item.baseScore + votePower)});
|
||||
item = _.extend(item, {baseScore: (item.baseScore - votePower)});
|
||||
updateScore({collection: collection, item: item, forceUpdate: true});
|
||||
|
||||
// if the item is being upvoted by its own author, don't give karma
|
||||
|
|
Loading…
Add table
Reference in a new issue