Description
Have a look at this code here ..
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 not isZeroStored !?
I think, the following code would be correct:
// 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()); }
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)