userkarma
This commit is contained in:
@@ -218,4 +218,21 @@ public class EntryManager {
|
||||
return upvotes - downvotes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the user points.
|
||||
*
|
||||
* @param entryId the entry id
|
||||
* @param username the username
|
||||
* @return the user points
|
||||
*/
|
||||
public long getUserPoints(Long entryId, String username) {
|
||||
long upvotes = voteRepository.count(qVote.targetType.eq(Types.entry)
|
||||
.and(qVote.type.eq(VoteType.up).and(qVote.author.ne(username)))
|
||||
.and(qVote.target.eq(entryId)));
|
||||
long downvotes = voteRepository.count(qVote.targetType.eq(Types.entry)
|
||||
.and(qVote.type.eq(VoteType.down).and(qVote.author.ne(username)))
|
||||
.and(qVote.target.eq(entryId)));
|
||||
return upvotes - downvotes;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user