branch develop updated (d18a3302 -> 32be1952)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git from d18a3302 Merge branch 'feature/CVE-updates' into 'develop' new 32be1952 ref #207 : correction de la validation des votes (entre autre la limitation des votes cumulatifs) The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 32be19522004c9c0073eb4872ee18027b321b4dd Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Tue May 15 10:17:41 2018 +0200 ref #207 : correction de la validation des votes (entre autre la limitation des votes cumulatifs) Summary of changes: .../pollen/services/service/VoteCountingService.java | 12 +++++++----- .../src/main/web/tag/poll/EditVote.tag.html | 5 ++--- .../voteCountingType/MajorityJudgmentConfig.tag.html | 7 +++++-- .../org/chorem/pollen/votecounting/VoteCounting.java | 17 +++++------------ .../chorem/pollen/votecounting/BordaVoteCounting.java | 14 +++++--------- .../i18n/pollen-votecounting-borda_en_GB.properties | 2 +- .../i18n/pollen-votecounting-borda_fr_FR.properties | 2 +- .../pollen/votecounting/CondorcetVoteCounting.java | 14 +++++--------- .../pollen-votecounting-condorcet_en_GB.properties | 2 +- .../pollen-votecounting-condorcet_fr_FR.properties | 2 +- .../chorem/pollen/votecounting/CoombsVoteCounting.java | 14 +++++--------- .../i18n/pollen-votecounting-coombs_en_GB.properties | 2 +- .../i18n/pollen-votecounting-coombs_fr_FR.properties | 2 +- .../pollen/votecounting/CumulativeVoteCounting.java | 18 +++++++----------- .../pollen-votecounting-cumulative_en_GB.properties | 3 ++- .../pollen-votecounting-cumulative_fr_FR.properties | 3 ++- .../pollen/votecounting/InstantRunoffVoteCounting.java | 14 +++++--------- ...pollen-votecounting-instant-runoff_en_GB.properties | 2 +- ...pollen-votecounting-instant-runoff_fr_FR.properties | 2 +- .../votecounting/MajorityJudgmentVoteCounting.java | 15 +++++---------- ...len-votecounting-majority-judgment_en_GB.properties | 2 +- ...len-votecounting-majority-judgment_fr_FR.properties | 2 +- .../chorem/pollen/votecounting/NormalVoteCounting.java | 12 ++++-------- .../chorem/pollen/votecounting/NumberVoteCounting.java | 12 ++++-------- 24 files changed, 73 insertions(+), 107 deletions(-) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
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 32be19522004c9c0073eb4872ee18027b321b4dd Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Tue May 15 10:17:41 2018 +0200 ref #207 : correction de la validation des votes (entre autre la limitation des votes cumulatifs) --- .../pollen/services/service/VoteCountingService.java | 12 +++++++----- .../src/main/web/tag/poll/EditVote.tag.html | 5 ++--- .../voteCountingType/MajorityJudgmentConfig.tag.html | 7 +++++-- .../org/chorem/pollen/votecounting/VoteCounting.java | 17 +++++------------ .../chorem/pollen/votecounting/BordaVoteCounting.java | 14 +++++--------- .../i18n/pollen-votecounting-borda_en_GB.properties | 2 +- .../i18n/pollen-votecounting-borda_fr_FR.properties | 2 +- .../pollen/votecounting/CondorcetVoteCounting.java | 14 +++++--------- .../pollen-votecounting-condorcet_en_GB.properties | 2 +- .../pollen-votecounting-condorcet_fr_FR.properties | 2 +- .../chorem/pollen/votecounting/CoombsVoteCounting.java | 14 +++++--------- .../i18n/pollen-votecounting-coombs_en_GB.properties | 2 +- .../i18n/pollen-votecounting-coombs_fr_FR.properties | 2 +- .../pollen/votecounting/CumulativeVoteCounting.java | 18 +++++++----------- .../pollen-votecounting-cumulative_en_GB.properties | 3 ++- .../pollen-votecounting-cumulative_fr_FR.properties | 3 ++- .../pollen/votecounting/InstantRunoffVoteCounting.java | 14 +++++--------- ...pollen-votecounting-instant-runoff_en_GB.properties | 2 +- ...pollen-votecounting-instant-runoff_fr_FR.properties | 2 +- .../votecounting/MajorityJudgmentVoteCounting.java | 15 +++++---------- ...len-votecounting-majority-judgment_en_GB.properties | 2 +- ...len-votecounting-majority-judgment_fr_FR.properties | 2 +- .../chorem/pollen/votecounting/NormalVoteCounting.java | 12 ++++-------- .../chorem/pollen/votecounting/NumberVoteCounting.java | 12 ++++-------- 24 files changed, 73 insertions(+), 107 deletions(-) diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteCountingService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteCountingService.java index d3b6870a..7ab3907f 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteCountingService.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteCountingService.java @@ -311,7 +311,7 @@ public class VoteCountingService extends PollenServiceSupport { protected <C extends VoteCountingConfig> ErrorMap voteIsValid(VoteBean vote, VoteCounting<?, C> voteCounting, List<ChoiceBean> choices, C config) { ErrorMap errors = new ErrorMap(); - Map<String, String> choiceNamesById = choices.stream().collect(Collectors.toMap(ChoiceBean::getEntityId, ChoiceBean::getChoiceValue)); + Map<String, Integer> choiceOrderById = choices.stream().collect(Collectors.toMap(ChoiceBean::getEntityId, ChoiceBean::getChoiceOrder)); Double total = null; for (VoteToChoiceBean choice : vote.getChoice()) { @@ -328,10 +328,12 @@ public class VoteCountingService extends PollenServiceSupport { check(errors, "voteValue#" + choice.getChoiceId().getReducedId(), - voteCounting.isVoteValueValid(voteValue), - voteCounting.getVoteValueNotValidMessage(getLocale(), - choiceNamesById.get(choice.getChoiceId().getEntityId()), - voteValue == null ? "" : voteValue.toString())); + voteCounting.isVoteValueValid(voteValue, config), + voteCounting.getVoteValueNotValidMessage( + getLocale(), + choiceOrderById.get(choice.getChoiceId().getEntityId()) + 1, + voteValue, + config)); } check(errors, diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/EditVote.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/EditVote.tag.html index 4e036616..54b3e9fb 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/EditVote.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/EditVote.tag.html @@ -8,12 +8,12 @@ it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. #L% @@ -67,7 +67,6 @@ type="number" required={!poll.voteCountingConfig.maxChoiceNumber} min="{poll.voteCountingTypeValue && poll.voteCountingTypeValue.minimumValue}" - max="{poll.voteCountingTypeValue && poll.voteCountingTypeValue.maximumValue}" onchange="{onVoteChanged}" ref="{choice.id}_voteValue" tabindex="{10 * (index + 1)}"> diff --git a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/MajorityJudgmentConfig.tag.html b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/MajorityJudgmentConfig.tag.html index 0338bfa6..f8a25589 100644 --- a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/MajorityJudgmentConfig.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/MajorityJudgmentConfig.tag.html @@ -8,12 +8,12 @@ it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. #L% @@ -39,11 +39,13 @@ type="text"> </div> <button class="c-button c-button--success" + type="button" title={parent.__.addGradAfter} onclick={addGradAfter(index)}> <i class="fa fa-plus" aria-hidden="true"></i> </button> <button class="c-button c-button--error" + type="button" title={parent.__.removeGrad} disabled={parent.opts.config.grades.length <= 3} onclick={removeGrad(index)}> @@ -52,6 +54,7 @@ </div> </div> <button class="c-button c-button--info default-grades" + type="button" onclick={setDefaultGrades}> {__.grades_default} </button> diff --git a/pollen-votecounting-api/src/main/java/org/chorem/pollen/votecounting/VoteCounting.java b/pollen-votecounting-api/src/main/java/org/chorem/pollen/votecounting/VoteCounting.java index eb127b3b..f25986b0 100644 --- a/pollen-votecounting-api/src/main/java/org/chorem/pollen/votecounting/VoteCounting.java +++ b/pollen-votecounting-api/src/main/java/org/chorem/pollen/votecounting/VoteCounting.java @@ -56,14 +56,6 @@ public interface VoteCounting<S extends VoteCountingStrategy<C>, C extends VoteC */ int getId(); - /** - * Get the value to display for a given vote value in the vote page. - * - * @param voteValue the vote value to display - * @return the string representation of a vote value - */ - String getDisplayVoteValue(Double voteValue); - /** * Test if the given value is a vote value (says users has filled it). * @@ -103,19 +95,20 @@ public interface VoteCounting<S extends VoteCountingStrategy<C>, C extends VoteC * @return {@code true} if the given vote value is valid, {@code false} * otherwise. */ - boolean isVoteValueValid(Double voteValue); + boolean isVoteValueValid(Double voteValue, C config); /** * If a vote value is not valid, gets the localized message of the error. * * @param locale the locale used to render the error message - * @param choiceName name of the choice + * @param choiceNumber number of the choice * @param voteValue value fo the vote * @return the localized validation message */ String getVoteValueNotValidMessage(Locale locale, - String choiceName, - String voteValue); + int choiceNumber, + Double voteValue, + C config); /** * Tests if the total values of a vote is valid. diff --git a/pollen-votecounting-borda/src/main/java/org/chorem/pollen/votecounting/BordaVoteCounting.java b/pollen-votecounting-borda/src/main/java/org/chorem/pollen/votecounting/BordaVoteCounting.java index 637bcc7f..64a6699c 100644 --- a/pollen-votecounting-borda/src/main/java/org/chorem/pollen/votecounting/BordaVoteCounting.java +++ b/pollen-votecounting-borda/src/main/java/org/chorem/pollen/votecounting/BordaVoteCounting.java @@ -56,15 +56,11 @@ public class BordaVoteCounting extends AbstractVoteCounting<BordaVoteCountingStr @Override public String getVoteValueNotValidMessage(Locale locale, - String choiceName, - String voteValue) { + int choiceNumber, + Double voteValue, + BordaConfig config) { return l(locale, "pollen.error.vote.invalidBordaVoteValue", - choiceName, voteValue); - } - - @Override - public String getDisplayVoteValue(Double voteValue) { - return voteValue == null ? "" : String.valueOf(voteValue); + choiceNumber, voteValue); } @Override @@ -98,7 +94,7 @@ public class BordaVoteCounting extends AbstractVoteCounting<BordaVoteCountingStr } @Override - public boolean isVoteValueValid(Double voteValue) { + public boolean isVoteValueValid(Double voteValue, BordaConfig config) { return voteValue != null && voteValue > 0; } diff --git a/pollen-votecounting-borda/src/main/resources/i18n/pollen-votecounting-borda_en_GB.properties b/pollen-votecounting-borda/src/main/resources/i18n/pollen-votecounting-borda_en_GB.properties index b0665a6d..72361b4f 100644 --- a/pollen-votecounting-borda/src/main/resources/i18n/pollen-votecounting-borda_en_GB.properties +++ b/pollen-votecounting-borda/src/main/resources/i18n/pollen-votecounting-borda_en_GB.properties @@ -1,4 +1,4 @@ -pollen.error.vote.invalidBordaVoteValue=The value '%2$s' of vote for choice %1$s is not valid, only integer values are authorized. +pollen.error.vote.invalidBordaVoteValue=The value '%2$s' of vote for choice n° %1$d is not valid, only integer values are authorized. pollen.voteCountingType.borda=Borda pollen.voteCountingType.borda.help=Rank choices by preference order from 1 to N (1\=favorite).<br/>Only the rank is taken into account, not the values. Two choices can have the same value.<br/>For each vote, points are won by the choices according to their rank (like for the Eurovision contest); the winner is the choice which have the most points.<br/>More about this method\: <a href\='http\://en.wikipedia.org/wiki/Borda_count' target\='\#doc'>http\://en.wikipedia.org/wiki/Borda_count</a> pollen.voteCountingType.borda.shortHelp=Rank choices by preference order from 1 to N (1\=favorite). diff --git a/pollen-votecounting-borda/src/main/resources/i18n/pollen-votecounting-borda_fr_FR.properties b/pollen-votecounting-borda/src/main/resources/i18n/pollen-votecounting-borda_fr_FR.properties index dd0d5b77..eb080073 100644 --- a/pollen-votecounting-borda/src/main/resources/i18n/pollen-votecounting-borda_fr_FR.properties +++ b/pollen-votecounting-borda/src/main/resources/i18n/pollen-votecounting-borda_fr_FR.properties @@ -1,4 +1,4 @@ -pollen.error.vote.invalidBordaVoteValue=La valeur du vote '%2$s' pour le choix %1$s n'est pas correcte, seul des valeurs entières sont autorisées. +pollen.error.vote.invalidBordaVoteValue=La valeur du vote '%2$s' pour le choix n° %1$d n'est pas correcte, seul des valeurs entières sont autorisées. pollen.voteCountingType.borda=Borda pollen.voteCountingType.borda.help=Classer les choix par ordre de préférence de 1 à N (1\=préféré).<br/> Seul l'ordre des choix compte, peu importe les valeurs. Deux choix peuvent avoir la même valeur.<br/>Pour chaque vote, on attribue des points aux choix en fonction de leur rang (comme pour le concours de l'Eurovision) ; le gagnant est le choix avec le plus de points.<br/>Pour en savoir plus \: <a href\='http\://fr.wikipedia.org/wiki/M%C3%A9thode_Borda' target\='\#doc'>http\://fr.wikip [...] pollen.voteCountingType.borda.shortHelp=Classer les choix par ordre de préférence de 1 à N (1\=préféré). diff --git a/pollen-votecounting-condorcet/src/main/java/org/chorem/pollen/votecounting/CondorcetVoteCounting.java b/pollen-votecounting-condorcet/src/main/java/org/chorem/pollen/votecounting/CondorcetVoteCounting.java index f43e8ea6..ced470a2 100644 --- a/pollen-votecounting-condorcet/src/main/java/org/chorem/pollen/votecounting/CondorcetVoteCounting.java +++ b/pollen-votecounting-condorcet/src/main/java/org/chorem/pollen/votecounting/CondorcetVoteCounting.java @@ -57,15 +57,11 @@ public class CondorcetVoteCounting extends AbstractVoteCounting<CondorcetVoteCou @Override public String getVoteValueNotValidMessage(Locale locale, - String choiceName, - String voteValue) { + int choiceNumber, + Double voteValue, + EmptyVoteCountingConfig config) { return l(locale, "pollen.error.vote.invalidCondorcetVoteValue", - choiceName, voteValue); - } - - @Override - public String getDisplayVoteValue(Double voteValue) { - return voteValue == null ? "" : String.valueOf(voteValue); + choiceNumber, voteValue); } @Override @@ -99,7 +95,7 @@ public class CondorcetVoteCounting extends AbstractVoteCounting<CondorcetVoteCou } @Override - public boolean isVoteValueValid(Double voteValue) { + public boolean isVoteValueValid(Double voteValue, EmptyVoteCountingConfig config) { return voteValue == null || voteValue > 0; } diff --git a/pollen-votecounting-condorcet/src/main/resources/i18n/pollen-votecounting-condorcet_en_GB.properties b/pollen-votecounting-condorcet/src/main/resources/i18n/pollen-votecounting-condorcet_en_GB.properties index ab5c4add..c322f441 100644 --- a/pollen-votecounting-condorcet/src/main/resources/i18n/pollen-votecounting-condorcet_en_GB.properties +++ b/pollen-votecounting-condorcet/src/main/resources/i18n/pollen-votecounting-condorcet_en_GB.properties @@ -1,4 +1,4 @@ -pollen.error.vote.invalidCondorcetVoteValue=The value '%2$s' of vote for choice %1$s is not valid, only integer values are authorized. +pollen.error.vote.invalidCondorcetVoteValue=The value '%2$d' of vote for choice n° %1$d is not valid, only integer values are authorized. pollen.voteCountingType.condorcet=Condorcet pollen.voteCountingType.condorcet.help=Rank choices by preference order from 1 to N (1\=favorite).<br/>Only the rank is taken into account, not the values. Two choices can have the same value.<br/>In this method, the winner is the choice which wins the most duels against the other choices.<br/>More about this method\: <a href\='http\://en.wikipedia.org/wiki/Condorcet_method' target\='\#doc'>http\://en.wikipedia.org/wiki/Condorcet_method</a> pollen.voteCountingType.condorcet.shortHelp=Rank choices by preference order from 1 to N (1\=favorite). diff --git a/pollen-votecounting-condorcet/src/main/resources/i18n/pollen-votecounting-condorcet_fr_FR.properties b/pollen-votecounting-condorcet/src/main/resources/i18n/pollen-votecounting-condorcet_fr_FR.properties index 1327db72..4b95875c 100644 --- a/pollen-votecounting-condorcet/src/main/resources/i18n/pollen-votecounting-condorcet_fr_FR.properties +++ b/pollen-votecounting-condorcet/src/main/resources/i18n/pollen-votecounting-condorcet_fr_FR.properties @@ -1,4 +1,4 @@ -pollen.error.vote.invalidCondorcetVoteValue=La valeur du vote '%2$s' pour le choix %1$s n'est pas correcte, seul des valeurs entières sont autorisées. +pollen.error.vote.invalidCondorcetVoteValue=La valeur du vote '%2$d' pour le choix n° %1$d n'est pas correcte, seul des valeurs entières sont autorisées. pollen.voteCountingType.condorcet=Condorcet pollen.voteCountingType.condorcet.help=Classer les choix par ordre de préférence de 1 à N (1\=préféré).<br/>Seul l'ordre des choix compte, peu importe les valeurs. Deux choix peuvent avoir la même valeur.<br/>Dans cette méthode, le gagnant est celui qui remporte le plus de duels par rapport aux autres choix.<br/>Pour en savoir plus \: <a href\='http\://fr.wikipedia.org/wiki/M%C3%A9thode_Condorcet' target\='\#doc'>http\://fr.wikipedia.org/wiki/Méthode_Condorcet</a> pollen.voteCountingType.condorcet.shortHelp=Classer les choix par ordre de préférence de 1 à N (1\=préféré). diff --git a/pollen-votecounting-coombs/src/main/java/org/chorem/pollen/votecounting/CoombsVoteCounting.java b/pollen-votecounting-coombs/src/main/java/org/chorem/pollen/votecounting/CoombsVoteCounting.java index 1d30fbd0..6606e1f9 100644 --- a/pollen-votecounting-coombs/src/main/java/org/chorem/pollen/votecounting/CoombsVoteCounting.java +++ b/pollen-votecounting-coombs/src/main/java/org/chorem/pollen/votecounting/CoombsVoteCounting.java @@ -57,18 +57,14 @@ public class CoombsVoteCounting extends AbstractVoteCounting<CoombsVoteCountingS @Override public String getVoteValueNotValidMessage(Locale locale, - String choiceName, - String voteValue) { + int choiceNumber, + Double voteValue, + EmptyVoteCountingConfig config) { return l(locale, "pollen.error.vote.invalidCoombsVoteValue", - choiceName, + choiceNumber, voteValue); } - @Override - public String getDisplayVoteValue(Double voteValue) { - return voteValue == null ? "" : String.valueOf(voteValue); - } - @Override public ChoiceToVoteRenderType getVoteValueEditorType() { return ChoiceToVoteRenderType.TEXTFIELD; @@ -100,7 +96,7 @@ public class CoombsVoteCounting extends AbstractVoteCounting<CoombsVoteCountingS } @Override - public boolean isVoteValueValid(Double voteValue) { + public boolean isVoteValueValid(Double voteValue, EmptyVoteCountingConfig config) { return voteValue != null && voteValue > 0; } diff --git a/pollen-votecounting-coombs/src/main/resources/i18n/pollen-votecounting-coombs_en_GB.properties b/pollen-votecounting-coombs/src/main/resources/i18n/pollen-votecounting-coombs_en_GB.properties index d6902ca1..cce09ceb 100644 --- a/pollen-votecounting-coombs/src/main/resources/i18n/pollen-votecounting-coombs_en_GB.properties +++ b/pollen-votecounting-coombs/src/main/resources/i18n/pollen-votecounting-coombs_en_GB.properties @@ -1,4 +1,4 @@ -pollen.error.vote.invalidCoombsVoteValue=The value '%2$s' of vote for choice %1$s is not valid, only integer values are authorized. +pollen.error.vote.invalidCoombsVoteValue=The value '%2$d' of vote for choice n° %1$d is not valid, only integer values are authorized. pollen.voteCountingType.coombs=Coombs pollen.voteCountingType.coombs.help=Rank choices by preference order from 1 to N (1\=favorite).<br/>Only the rank is taken into account, not the values. Two choices can have the same value.<br/>In this method, the choice which is last the most times is eliminated round by round until only one remains.<br/>More about this method\: <a href\='http\://en.wikipedia.org/wiki/Coombs%27_method' target\='\#doc'>http\://en.wikipedia.org/wiki/Coombs_method</a> pollen.voteCountingType.coombs.shortHelp=Rank choices by preference order from 1 to N (1\=favorite). diff --git a/pollen-votecounting-coombs/src/main/resources/i18n/pollen-votecounting-coombs_fr_FR.properties b/pollen-votecounting-coombs/src/main/resources/i18n/pollen-votecounting-coombs_fr_FR.properties index a62223d3..1c689915 100644 --- a/pollen-votecounting-coombs/src/main/resources/i18n/pollen-votecounting-coombs_fr_FR.properties +++ b/pollen-votecounting-coombs/src/main/resources/i18n/pollen-votecounting-coombs_fr_FR.properties @@ -1,4 +1,4 @@ -pollen.error.vote.invalidCoombsVoteValue=La valeur du vote '%2$s' pour le choix %1$s n'est pas correcte, seul des valeurs entières sont autorisées. +pollen.error.vote.invalidCoombsVoteValue=La valeur du vote '%2$d' pour le choix n° %1$d n'est pas correcte, seul des valeurs entières sont autorisées. pollen.voteCountingType.coombs=Coombs pollen.voteCountingType.coombs.help=Classer les choix par ordre de préférence de 1 à N (1\=préféré).<br/>Seul l'ordre des choix compte, peu importe les valeurs. Deux choix peuvent avoir la même valeur.<br/>Dans cette méthode, le choix qui arrive le plus souvent en dernier de liste est éliminé à chaque tour, jusqu'à ce qu'il n'en reste qu'un.<br/>Pour en savoir plus \: <a href\='http\://fr.wikipedia.org/wiki/M%C3%A9thode_de_Coombs' target\='\#doc'>http\://fr.wikipedia.org/wiki/Méthode_de_ [...] pollen.voteCountingType.coombs.shortHelp=Classer les choix par ordre de préférence de 1 à N (1\=préféré). diff --git a/pollen-votecounting-cumulative/src/main/java/org/chorem/pollen/votecounting/CumulativeVoteCounting.java b/pollen-votecounting-cumulative/src/main/java/org/chorem/pollen/votecounting/CumulativeVoteCounting.java index 4ed03213..26f4da3f 100644 --- a/pollen-votecounting-cumulative/src/main/java/org/chorem/pollen/votecounting/CumulativeVoteCounting.java +++ b/pollen-votecounting-cumulative/src/main/java/org/chorem/pollen/votecounting/CumulativeVoteCounting.java @@ -48,11 +48,6 @@ public class CumulativeVoteCounting extends AbstractVoteCounting<CumulativeVoteC ); } - @Override - public String getDisplayVoteValue(Double voteValue) { - return voteValue == null ? "" : String.valueOf(voteValue) + "%"; - } - @Override public boolean isChoiceInVote(Double voteValue) { return voteValue != null && voteValue >= 0 && voteValue <= 100; @@ -81,12 +76,12 @@ public class CumulativeVoteCounting extends AbstractVoteCounting<CumulativeVoteC @Override public Double getMaximumValue() { - return 100d; + return null; } @Override - public boolean isVoteValueValid(Double voteValue) { - return voteValue == null || 0 <= voteValue && voteValue <= 100; + public boolean isVoteValueValid(Double voteValue, CumulativeConfig cumulativeConfig) { + return voteValue == null || 0 <= voteValue && voteValue <= cumulativeConfig.getPoints(); } @Override @@ -96,10 +91,11 @@ public class CumulativeVoteCounting extends AbstractVoteCounting<CumulativeVoteC @Override public String getVoteValueNotValidMessage(Locale locale, - String choiceName, - String voteValue) { + int choiceNumber, + Double voteValue, + CumulativeConfig cumulativeConfig) { // no validation on not null vote value, so no message - return null; + return l(locale, "pollen.error.voteValue.cumulative", choiceNumber, voteValue == null ? "" : voteValue.intValue(), cumulativeConfig.getPoints()); } @Override diff --git a/pollen-votecounting-cumulative/src/main/resources/i18n/pollen-votecounting-cumulative_en_GB.properties b/pollen-votecounting-cumulative/src/main/resources/i18n/pollen-votecounting-cumulative_en_GB.properties index 00701bf7..66965116 100644 --- a/pollen-votecounting-cumulative/src/main/resources/i18n/pollen-votecounting-cumulative_en_GB.properties +++ b/pollen-votecounting-cumulative/src/main/resources/i18n/pollen-votecounting-cumulative_en_GB.properties @@ -1,4 +1,5 @@ -pollen.error.vote.cumulative=choices sum must be equals to %1$s +pollen.error.vote.cumulative=choices sum must be equals to %1$d +pollen.error.voteValue.cumulative=The value '%2$d' of vote for choice n° %1$s must be between 0 and %3$s pollen.voteCountingType.cumulative=Cumulative pollen.voteCountingType.cumulative.help=Each voter has a given number of points. He distributes this number of points freely between all choices. The choice of the most points wins.<br/>More about this method\: <a href\='http\://en.wikipedia.org/wiki/Cumulative_voting' target\='\#doc'>http\://en.wikipedia.org/wiki/Cumulative_voting</a> pollen.voteCountingType.cumulative.shortHelp=Allocate your points between all choices. diff --git a/pollen-votecounting-cumulative/src/main/resources/i18n/pollen-votecounting-cumulative_fr_FR.properties b/pollen-votecounting-cumulative/src/main/resources/i18n/pollen-votecounting-cumulative_fr_FR.properties index f329e9db..240a6e34 100644 --- a/pollen-votecounting-cumulative/src/main/resources/i18n/pollen-votecounting-cumulative_fr_FR.properties +++ b/pollen-votecounting-cumulative/src/main/resources/i18n/pollen-votecounting-cumulative_fr_FR.properties @@ -1,4 +1,5 @@ -pollen.error.vote.cumulative=La somme de tous les choix doit être égale à %1$s +pollen.error.vote.cumulative=La somme de tous les choix doit être égale à %1$d +pollen.error.voteValue.cumulative=La valeur du vote '%2$s' pour le choix n° %1$s doit être comprise entre 0 et %3$s (inclus) pollen.voteCountingType.cumulative=Cumulatif pollen.voteCountingType.cumulative.help=Chaque votant possède un nombre de points donnés. Il distribue ce nombre de points librement entre tous les choix. Le choix récoltant le plus de points gagne. <br/>Pour en savoir plus \: <a href\='http\://fr.wikipedia.org/wiki/Vote_cumulatif' target\='\#doc'>http\://fr.wikipedia.org/wiki/Vote_cumulatif</a> pollen.voteCountingType.cumulative.shortHelp=Répartir vos points entre tous les choix. diff --git a/pollen-votecounting-instant-runoff/src/main/java/org/chorem/pollen/votecounting/InstantRunoffVoteCounting.java b/pollen-votecounting-instant-runoff/src/main/java/org/chorem/pollen/votecounting/InstantRunoffVoteCounting.java index 111368cd..86ae082f 100644 --- a/pollen-votecounting-instant-runoff/src/main/java/org/chorem/pollen/votecounting/InstantRunoffVoteCounting.java +++ b/pollen-votecounting-instant-runoff/src/main/java/org/chorem/pollen/votecounting/InstantRunoffVoteCounting.java @@ -57,18 +57,14 @@ public class InstantRunoffVoteCounting extends AbstractVoteCounting<InstantRunof @Override public String getVoteValueNotValidMessage(Locale locale, - String choiceName, - String voteValue) { + int choiceNumber, + Double voteValue, + EmptyVoteCountingConfig config) { return l(locale, "pollen.error.vote.invalidInstantRunoffVoteValue", - choiceName, + choiceNumber, voteValue); } - @Override - public String getDisplayVoteValue(Double voteValue) { - return voteValue == null ? "" : String.valueOf(voteValue); - } - @Override public ChoiceToVoteRenderType getVoteValueEditorType() { return ChoiceToVoteRenderType.TEXTFIELD; @@ -100,7 +96,7 @@ public class InstantRunoffVoteCounting extends AbstractVoteCounting<InstantRunof } @Override - public boolean isVoteValueValid(Double voteValue) { + public boolean isVoteValueValid(Double voteValue, EmptyVoteCountingConfig config) { return voteValue != null && voteValue > 0; } diff --git a/pollen-votecounting-instant-runoff/src/main/resources/i18n/pollen-votecounting-instant-runoff_en_GB.properties b/pollen-votecounting-instant-runoff/src/main/resources/i18n/pollen-votecounting-instant-runoff_en_GB.properties index 0e4bf0d3..54952136 100644 --- a/pollen-votecounting-instant-runoff/src/main/resources/i18n/pollen-votecounting-instant-runoff_en_GB.properties +++ b/pollen-votecounting-instant-runoff/src/main/resources/i18n/pollen-votecounting-instant-runoff_en_GB.properties @@ -1,4 +1,4 @@ -pollen.error.vote.invalidInstantRunoffVoteValue=The value '%2$s' of vote for choice %1$s is not valid, only integer values are authorized. +pollen.error.vote.invalidInstantRunoffVoteValue=The value '%2$s' of vote for choice n° %1$d is not valid, only integer values are authorized. pollen.voteCountingType.instantRunoff=Instant Runoff pollen.voteCountingType.instantRunoff.help=Rank choices by preference order from 1 to N (1\=favorite).<br/>Only the rank is taken into account, not the values. Two choices can have the same value.<br/>In this method, the choice which is first the least times is eliminated round by round until only one remains.<br/>More about this method\: <a href\='http\://en.wikipedia.org/wiki/Instant-runoff_voting' target\='\#doc'>http\://en.wikipedia.org/wiki/Instant-runoff_voting</a> pollen.voteCountingType.instantRunoff.shortHelp=Rank choices by preference order from 1 to N (1\=favorite). diff --git a/pollen-votecounting-instant-runoff/src/main/resources/i18n/pollen-votecounting-instant-runoff_fr_FR.properties b/pollen-votecounting-instant-runoff/src/main/resources/i18n/pollen-votecounting-instant-runoff_fr_FR.properties index 85d6e028..379523e2 100644 --- a/pollen-votecounting-instant-runoff/src/main/resources/i18n/pollen-votecounting-instant-runoff_fr_FR.properties +++ b/pollen-votecounting-instant-runoff/src/main/resources/i18n/pollen-votecounting-instant-runoff_fr_FR.properties @@ -1,4 +1,4 @@ -pollen.error.vote.invalidInstantRunoffVoteValue=La valeur du vote '%2$s' pour le choix %1$s n'est pas correcte, seul des valeurs entières sont autorisées. +pollen.error.vote.invalidInstantRunoffVoteValue=La valeur du vote '%2$s' pour le choix n° %1$d n'est pas correcte, seul des valeurs entières sont autorisées. pollen.voteCountingType.instantRunoff=Vote alternatif pollen.voteCountingType.instantRunoff.help=Classer les choix par ordre de préférence de 1 à N (1\=préféré).<br/>Seul l'ordre des choix compte, peu importe les valeurs. Deux choix peuvent avoir la même valeur.<br/>Dans cette méthode, le choix qui arrive le moins souvent en premier de liste est éliminé à chaque tour, jusqu'à ce qu'il n'en reste qu'un.<br/>Pour en savoir plus \: <a href\='http\://fr.wikipedia.org/wiki/Vote_alternatif' target\='\#doc'>http\://fr.wikipedia.org/wiki/Vote_alter [...] pollen.voteCountingType.instantRunoff.shortHelp=Classer les choix par ordre de préférence de 1 à N (1\=préféré). diff --git a/pollen-votecounting-majority-judgment/src/main/java/org/chorem/pollen/votecounting/MajorityJudgmentVoteCounting.java b/pollen-votecounting-majority-judgment/src/main/java/org/chorem/pollen/votecounting/MajorityJudgmentVoteCounting.java index f06c5363..7bef418b 100644 --- a/pollen-votecounting-majority-judgment/src/main/java/org/chorem/pollen/votecounting/MajorityJudgmentVoteCounting.java +++ b/pollen-votecounting-majority-judgment/src/main/java/org/chorem/pollen/votecounting/MajorityJudgmentVoteCounting.java @@ -53,16 +53,11 @@ public class MajorityJudgmentVoteCounting extends AbstractVoteCounting<MajorityJ @Override public String getVoteValueNotValidMessage(Locale locale, - String choiceName, - String voteValue) { + int choiceNumber, + Double voteValue, + MajorityJudgmentConfig config) { return l(locale, "pollen.error.vote.invalidMajorityJudgmentVoteValue", - choiceName, - voteValue); - } - - @Override - public String getDisplayVoteValue(Double voteValue) { - return voteValue == null ? "" : String.valueOf(voteValue); + choiceNumber); } @Override @@ -96,7 +91,7 @@ public class MajorityJudgmentVoteCounting extends AbstractVoteCounting<MajorityJ } @Override - public boolean isVoteValueValid(Double voteValue) { + public boolean isVoteValueValid(Double voteValue, MajorityJudgmentConfig config) { return voteValue != null && voteValue >= 0; } diff --git a/pollen-votecounting-majority-judgment/src/main/resources/i18n/pollen-votecounting-majority-judgment_en_GB.properties b/pollen-votecounting-majority-judgment/src/main/resources/i18n/pollen-votecounting-majority-judgment_en_GB.properties index 8159dff0..77c47c20 100644 --- a/pollen-votecounting-majority-judgment/src/main/resources/i18n/pollen-votecounting-majority-judgment_en_GB.properties +++ b/pollen-votecounting-majority-judgment/src/main/resources/i18n/pollen-votecounting-majority-judgment_en_GB.properties @@ -1,4 +1,4 @@ -pollen.error.vote.invalidMajorityJudgmentVoteValue=Grade is required +pollen.error.vote.invalidMajorityJudgmentVoteValue=Grade for the choice n° %1$d is required pollen.voteCountingType.majorityJudgment=Majority judgment pollen.voteCountingType.majorityJudgment.help=Voters freely grade each candidate in one of several named ranks. The choice with the highest median grade is the winner.<br/>More about this method\: <a href\='http\://en.wikipedia.org/wiki/Majority_judgment' target\='\#doc'>http\://en.wikipedia.org/wiki/Majority_judgment</a> pollen.voteCountingType.majorityJudgment.shortHelp=Voters freely grade each choice in one of several named ranks. diff --git a/pollen-votecounting-majority-judgment/src/main/resources/i18n/pollen-votecounting-majority-judgment_fr_FR.properties b/pollen-votecounting-majority-judgment/src/main/resources/i18n/pollen-votecounting-majority-judgment_fr_FR.properties index d3558e76..95b76f8a 100644 --- a/pollen-votecounting-majority-judgment/src/main/resources/i18n/pollen-votecounting-majority-judgment_fr_FR.properties +++ b/pollen-votecounting-majority-judgment/src/main/resources/i18n/pollen-votecounting-majority-judgment_fr_FR.properties @@ -1,4 +1,4 @@ -pollen.error.vote.invalidMajorityJudgmentVoteValue=La mention est obligatoire. +pollen.error.vote.invalidMajorityJudgmentVoteValue=La mention pour le choix n° %1$d est obligatoire. pollen.voteCountingType.majorityJudgment=Jugement majoritaire pollen.voteCountingType.majorityJudgment.help=Attribuer à chaque choix une mention parmi une échelle commune à tous.<br/>Deux choix peuvent avoir la même mention. Pour chaque choix, on détermine la mention médiane, qu'on appelle « mention majoritaire ».<br/>Le choix avec la meilleur mention majoritaire gagne.<br/>Pour en savoir plus \: <a href\='http\://fr.wikipedia.org/wiki/Jugement_majoritaire' target\='\#doc'>http\://fr.wikipedia.org/wiki/Jugement_majoritaire</a> pollen.voteCountingType.majorityJudgment.shortHelp=Attribuer à chaque choix une mention parmi une échelle commune à tous. diff --git a/pollen-votecounting-normal/src/main/java/org/chorem/pollen/votecounting/NormalVoteCounting.java b/pollen-votecounting-normal/src/main/java/org/chorem/pollen/votecounting/NormalVoteCounting.java index e271e7b5..8890a75b 100644 --- a/pollen-votecounting-normal/src/main/java/org/chorem/pollen/votecounting/NormalVoteCounting.java +++ b/pollen-votecounting-normal/src/main/java/org/chorem/pollen/votecounting/NormalVoteCounting.java @@ -48,11 +48,6 @@ public class NormalVoteCounting extends AbstractVoteCounting<NormalVoteCountingS ); } - @Override - public String getDisplayVoteValue(Double voteValue) { - return isChoiceInVote(voteValue) ? "[x]" : "[ ]"; - } - @Override public boolean isChoiceInVote(Double voteValue) { return voteValue != null && voteValue > 0; @@ -84,7 +79,7 @@ public class NormalVoteCounting extends AbstractVoteCounting<NormalVoteCountingS } @Override - public boolean isVoteValueValid(Double voteValue) { + public boolean isVoteValueValid(Double voteValue, MaxChoicesNumberConfig config) { // no validation on not null vote value return true; } @@ -97,8 +92,9 @@ public class NormalVoteCounting extends AbstractVoteCounting<NormalVoteCountingS @Override public String getVoteValueNotValidMessage(Locale locale, - String choiceName, - String voteValue) { + int choiceNumber, + Double voteValue, + MaxChoicesNumberConfig config) { // no validation on not null vote value, so no message return null; } diff --git a/pollen-votecounting-number/src/main/java/org/chorem/pollen/votecounting/NumberVoteCounting.java b/pollen-votecounting-number/src/main/java/org/chorem/pollen/votecounting/NumberVoteCounting.java index 1aad2a1d..bb04ae78 100644 --- a/pollen-votecounting-number/src/main/java/org/chorem/pollen/votecounting/NumberVoteCounting.java +++ b/pollen-votecounting-number/src/main/java/org/chorem/pollen/votecounting/NumberVoteCounting.java @@ -48,11 +48,6 @@ public class NumberVoteCounting extends AbstractVoteCounting<NumberVoteCountingS ); } - @Override - public String getDisplayVoteValue(Double voteValue) { - return voteValue == null ? "" : String.valueOf(voteValue); - } - @Override public boolean isChoiceInVote(Double voteValue) { return voteValue != null && voteValue >= 0; @@ -84,7 +79,7 @@ public class NumberVoteCounting extends AbstractVoteCounting<NumberVoteCountingS } @Override - public boolean isVoteValueValid(Double voteValue) { + public boolean isVoteValueValid(Double voteValue, MaxChoicesNumberConfig config) { // no validation on not null vote value return true; } @@ -103,8 +98,9 @@ public class NumberVoteCounting extends AbstractVoteCounting<NumberVoteCountingS @Override public String getVoteValueNotValidMessage(Locale locale, - String choiceName, - String voteValue) { + int choiceNumber, + Double voteValue, + MaxChoicesNumberConfig config) { // no validation on not null vote value, so no message return null; } -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm