This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 57f13c09cf6f79a176f705051c3953e3d27f3ff5 Author: Kevin Morin <morin@codelutin.com> Date: Tue Apr 18 17:05:39 2017 +0200 Vote impossible si la date est dépassée --- .../org/chorem/pollen/persistence/entity/Polls.java | 21 ++++----------------- .../chorem/pollen/services/service/VoteService.java | 1 + .../resources/i18n/pollen-services_en_GB.properties | 1 + .../resources/i18n/pollen-services_fr_FR.properties | 3 ++- 4 files changed, 8 insertions(+), 18 deletions(-) diff --git a/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/Polls.java b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/Polls.java index bebf48a..dd907a9 100644 --- a/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/Polls.java +++ b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/Polls.java @@ -55,18 +55,18 @@ public class Polls { !isFinished(poll, currentDate); } - public boolean isFinished(Poll poll, Date currentDate) { + public static boolean isFinished(Poll poll, Date currentDate) { Date endDate = poll.getEndDate(); return endDate != null && currentDate.after(endDate); } - public boolean isAddChoiceStarted(Poll poll, Date currentDate) { + public static boolean isAddChoiceStarted(Poll poll, Date currentDate) { Date beginChoiceDate = poll.getBeginChoiceDate(); return poll.isChoiceAddAllowed() && (beginChoiceDate == null || beginChoiceDate.before(currentDate)); } - public boolean isAddChoiceRunning(Poll poll, Date currentDate) { + public static boolean isAddChoiceRunning(Poll poll, Date currentDate) { return poll.isChoiceAddAllowed() && !poll.isClosed() && !isFinished(poll, currentDate) && @@ -74,22 +74,9 @@ public class Polls { !isAddChoiceFinished(poll, currentDate); } - public boolean isAddChoiceFinished(Poll poll, Date currentDate) { + public static boolean isAddChoiceFinished(Poll poll, Date currentDate) { Date endChoiceDate = poll.getEndChoiceDate(); return !poll.isChoiceAddAllowed() || (endChoiceDate != null && endChoiceDate.before(currentDate)); } - -// public static Set<VoterListMember> getAllVoters(Poll poll) { -// Set<VoterListMember> result = Sets.newHashSet(); -// if (poll.isVoterListNotEmpty()) { -// for (VoterList list : poll.getVoterList()) { -// -// if (!list.isMemberEmpty()) { -// result.addAll(list.getMember()); -// } -// } -// } -// return result; -// } } diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java index f25f779..e8d02f9 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java @@ -194,6 +194,7 @@ public class VoteService extends PollenServiceSupport { Date now = serviceContext.getNow(); check(errors, "poll", Polls.isStarted(poll, now), l(getLocale(), "pollen.error.vote.poll.notStarted")); + check(errors, "poll", !Polls.isFinished(poll, now), l(getLocale(), "pollen.error.vote.poll.finished")); boolean voteNameNotBlank = checkNotBlank(errors, "voter.name", vote.getVoterName(), l(getLocale(), "pollen.error.vote.voterName.mandatory")); diff --git a/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties b/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties index 400d411..5a372b5 100644 --- a/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties +++ b/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties @@ -79,6 +79,7 @@ pollen.error.user.mailInvalid=email is not valid pollen.error.user.passwordEmpty=password can not be empty pollen.error.user.passwordInvalid=password is not valid pollen.error.vote.limitedVote.overflow=Too many choices +pollen.error.vote.poll.finished=Votes are finished, you cannot vote anymore pollen.error.vote.poll.isClosed=poll is closed, you can't vote pollen.error.vote.poll.notStarted=poll is not started pollen.error.vote.totalVote.invalid=Total vote value is invalid diff --git a/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties b/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties index b3e39a4..ae604bd 100644 --- a/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties +++ b/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties @@ -78,7 +78,8 @@ pollen.error.user.mailInvalid=Courriel est invalide pollen.error.user.passwordEmpty=Mot de passe ne peut pas être vide pollen.error.user.passwordInvalid=Mot de passe est invalide pollen.error.vote.limitedVote.overflow=Le nombre de choix maximal atteind -pollen.error.vote.poll.isClosed=Le sondage est clos, vous pouvez voter +pollen.error.vote.poll.finished=Les votes sont terminés, vous ne pouvez plus voter +pollen.error.vote.poll.isClosed=Le sondage est clos, vous ne pouvez plus voter pollen.error.vote.poll.notStarted=Les votes n'ont pas commencé pollen.error.vote.totalVote.invalid=Le total des valeurs est invalide pollen.error.vote.voteValue.invalid=La valeur est invalide -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.