Author: tchemit Date: 2012-09-19 12:07:02 +0200 (Wed, 19 Sep 2012) New Revision: 3693 Url: http://chorem.org/repositories/revision/pollen/3693 Log: fixes #811: Bad vote validation Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/vote/VoteForPoll.java trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/vote/VoteForPoll.java =================================================================== --- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/vote/VoteForPoll.java 2012-09-19 08:25:53 UTC (rev 3692) +++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/vote/VoteForPoll.java 2012-09-19 10:07:02 UTC (rev 3693) @@ -111,12 +111,13 @@ VoteCountingStrategy strategy = getVoteCountingStrategy(getPoll()); boolean voteValid = true; - int voteNumber = 0; + int voteNumber = -1; for (VoteToChoice voteToChoice : vote.getChoiceVoteToChoice()) { + voteNumber++; Integer value = voteToChoice.getVoteValue(); - if (value==null) { + if (value == null) { // check value if same as the one return by request // otherwise it means there is a conversion error @@ -127,7 +128,7 @@ // vote value changed String validMessage = - _("pollen.error.vote.invalidFormat", paramValue); + _("pollen.error.vote.invalidFormat", voteToChoice.getChoice().getName(), paramValue); addFieldError("vote.choices", validMessage); voteValid = false; break; Modified: trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties =================================================================== --- trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-09-19 08:25:53 UTC (rev 3692) +++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-09-19 10:07:02 UTC (rev 3693) @@ -232,7 +232,7 @@ pollen.error.user.restrictedListsForbidden=The poll is restricted and you are not allowed to vote. Check if you have correctly used the link sent to you by email. pollen.error.userNotAllowed=You are not allowed to count the votes for this poll. pollen.error.vote.invalidCondorcetVoteValue=Invalid position\: in a condorcet vote, you can let empty values, or put values greater than zero. -pollen.error.vote.invalidFormat=Vote value invalid (must be a integer number) +pollen.error.vote.invalidFormat=Vote '%s' value %s is invalid (must be a integer number) pollen.error.vote.maxChoiceNb=The maximal number of choices is %d. pollen.error.vote.percentage=The sum of the values must be equals to 100. pollen.fieldset.choice.options=Choices Modified: trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties =================================================================== --- trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-09-19 08:25:53 UTC (rev 3692) +++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-09-19 10:07:02 UTC (rev 3693) @@ -233,7 +233,7 @@ pollen.error.user.restrictedListsForbidden=Le sondage est restreint et vous n'êtes pas autorisé à voter. Vérifiez que vous avez bien utiliser le lien qui vous a été envoyé. pollen.error.userNotAllowed=Vous n'êtes pas autorisé à dépouiller ce sondage. pollen.error.vote.invalidCondorcetVoteValue=Position invalide \: dans un vote condorcet, vous pouvez soit laisser laisser vide un choix, soit mettre une valeur strictement positive. -pollen.error.vote.invalidFormat=Valeur de vote %s invalide (doit être un nombre entier) +pollen.error.vote.invalidFormat=Valeur de vote '%s' %s invalide (doit être un nombre entier) pollen.error.vote.maxChoiceNb=Le nombre de choix maximal est de %d. pollen.error.vote.percentage=La somme des valeurs doit être égale à 100. pollen.fieldset.choice.options=Les choix