-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Open
Description
In stackoverflow design in both Answer and Question class, in vote API voter's reputation should change instead author.
// Before
@OverRide
public void vote(User voter, VoteType type) {
votes.removeIf(v -> v.getVoter().equals(voter));
votes.add(new Vote(voter, type));
author.updateReputation(10 * (type == VoteType.UPVOTE ? 1 : -1)); // +10 for upvote, -10 for downvote
}
//After
@OverRide
public void vote(User voter, VoteType type) {
votes.removeIf(v -> v.getVoter().equals(voter));
votes.add(new Vote(voter, type));
voter.updateReputation(10 * (type == VoteType.UPVOTE ? 1 : -1)); // +10 for upvote, -10 for downvote
}
Metadata
Metadata
Assignees
Labels
No labels