Have a look at this code [here|https://github.com/xwiki/xwiki-platform/blob/61a2b2cd951e069ca45a2b2aa6336c98178a532c/xwiki-platform-core/xwiki-platform-ratings/xwiki-platform-ratings-api/src/main/java/org/xwiki/ratings/internal/SolrRatingsManager.java#L316-L327] ..
The case "or if we store zero" is not catched with the if-condition {{if(vote ! Unable to render embedded object: File ( = 0)}}. Thus for a 0-vote the else branch will be called. That however will remove the rating, *if* isZeroStored is configured. I thought it should rather remove, if *!*isZeroStored !?
I think, the following code would be correct: {code:java} // If the vote is not 0 or if we store zero, we just modify the existing vote if (vote != 0 || this.ratingsConfiguration.isZeroStored()) { result = new DefaultRating(oldRating) .setUpdatedAt(new Date()) .setVote(vote);
// It's an update of a vote event = new UpdatedRatingEvent(result, oldRating.getVote()); // Else we remove it. } else { this.removeRating(oldRating.getId()); } {code} Then, the if-Block catches three cases (either of vote != 0 or isZeroStored or both are true) and the else-Block catches the left over case (vote == 0 and !isZeroStored) |
|