Skip to content

Commit

Permalink
Fixes #249
Browse files Browse the repository at this point in the history
  • Loading branch information
1-alex98 committed Sep 9, 2018
1 parent d9f737d commit 6a4b024
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public Integer getOrdinal() {

@Transient
@ComputedAttribute
public int getNumberOfAnswers() {
public Integer getNumberOfAnswers() {
return numberOfAnswers;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import javax.validation.ConstraintValidatorContext;
import java.time.OffsetDateTime;

/**
* Avoids that a VotingSubject's result is revealed before the vote on the subject ended
*/
public class VotingSubjectRevealWinnerValidator implements ConstraintValidator<VotingSubjectRevealWinnerCheck, VotingSubject> {

@Override
Expand All @@ -15,6 +18,6 @@ public void initialize(VotingSubjectRevealWinnerCheck constraintAnnotation) {

@Override
public boolean isValid(VotingSubject votingSubject, ConstraintValidatorContext context) {
return votingSubject.getRevealWinner() && votingSubject.getEndOfVoteTime().isBefore(OffsetDateTime.now());
return votingSubject.getRevealWinner() != Boolean.TRUE || votingSubject.getEndOfVoteTime().isBefore(OffsetDateTime.now());
}
}

0 comments on commit 6a4b024

Please sign in to comment.