branch develop updated (d0f6837 -> e3445fe)
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 d0f6837 gestion des listes de favoris new a45b1d8 refs #15 affichage ou non de la limite de choix à sélectionner en fonction du type de sondage new aef052c refs #15 ajout de la possibilité ou non de limiter le nombre de choix par vote en fonction du type (+ ajout des bornes min max des valeurs possibles et correction des messages d'erreur) new 1ca4434 refs #15 ajout des nouvelles propriétés des types de vote new e1b985f Conversion des chaines vides en Double null (pour les votes) new 7898850 refs #15 prise en compte de la limite de choix par vote + gestion des erreurs sur le vote new e3445fe Gestion des messages d'erreur de vote dans les types de vote The 6 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 e3445feac5975f411a283379a095d631d67365d1 Author: Kevin Morin <morin@codelutin.com> Date: Thu Apr 13 17:50:47 2017 +0200 Gestion des messages d'erreur de vote dans les types de vote commit 7898850c9790be0d5b99c4ee2085233c20fd91ad Author: Kevin Morin <morin@codelutin.com> Date: Thu Apr 13 17:49:24 2017 +0200 refs #15 prise en compte de la limite de choix par vote + gestion des erreurs sur le vote commit e1b985f05c79117284ca99a238e41b01a16dd680 Author: Kevin Morin <morin@codelutin.com> Date: Thu Apr 13 17:48:45 2017 +0200 Conversion des chaines vides en Double null (pour les votes) commit 1ca4434222d76ee47cca65cad7d11a2d818fc10c Author: Kevin Morin <morin@codelutin.com> Date: Thu Apr 13 17:47:54 2017 +0200 refs #15 ajout des nouvelles propriétés des types de vote commit aef052cea55ef15be98f2f24ff619c0769a82ec8 Author: Kevin Morin <morin@codelutin.com> Date: Thu Apr 13 17:46:01 2017 +0200 refs #15 ajout de la possibilité ou non de limiter le nombre de choix par vote en fonction du type (+ ajout des bornes min max des valeurs possibles et correction des messages d'erreur) commit a45b1d85932eb294ce5d9e8fe430f89d22762f3f Author: Kevin Morin <morin@codelutin.com> Date: Thu Apr 13 17:43:40 2017 +0200 refs #15 affichage ou non de la limite de choix à sélectionner en fonction du type de sondage Summary of changes: .../org/chorem/pollen/rest/api/JsonHelper.java | 12 +++- .../pollen/services/bean/VoteCountingTypeBean.java | 30 ++++++++ .../pollen/services/service/PollService.java | 5 +- .../services/service/VoteCountingService.java | 22 +++--- .../services/service/VoteCountingTypeService.java | 3 + .../pollen/services/service/VoteService.java | 11 +-- .../i18n/pollen-services_fr_FR.properties | 14 ++-- pollen-ui-riot-js/src/main/web/i18n.json | 2 + .../src/main/web/tag/poll/Settings.tag.html | 57 ++++++++------- .../src/main/web/tag/poll/Votes.tag.html | 83 +++++++++++++++------- .../chorem/pollen/votecounting/VoteCounting.java | 26 ++++++- .../pollen/votecounting/BordaVoteCounting.java | 15 ++++ .../pollen-votecounting-borda_en_GB.properties | 2 +- .../pollen-votecounting-borda_fr_FR.properties | 2 +- .../pollen/votecounting/CondorcetVoteCounting.java | 15 ++++ .../pollen-votecounting-condorcet_en_GB.properties | 2 +- .../pollen-votecounting-condorcet_fr_FR.properties | 2 +- .../pollen/votecounting/CoombsVoteCounting.java | 15 ++++ .../pollen-votecounting-coombs_en_GB.properties | 2 +- .../pollen-votecounting-coombs_fr_FR.properties | 2 +- .../votecounting/InstantRunoffVoteCounting.java | 17 ++++- ...en-votecounting-instant-runoff_en_GB.properties | 2 +- ...en-votecounting-instant-runoff_fr_FR.properties | 2 +- .../pollen/votecounting/NormalVoteCounting.java | 15 ++++ .../pollen/votecounting/NumberVoteCounting.java | 15 ++++ .../votecounting/PercentageVoteCounting.java | 15 ++++ 26 files changed, 307 insertions(+), 81 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 a45b1d85932eb294ce5d9e8fe430f89d22762f3f Author: Kevin Morin <morin@codelutin.com> Date: Thu Apr 13 17:43:40 2017 +0200 refs #15 affichage ou non de la limite de choix à sélectionner en fonction du type de sondage --- .../src/main/web/tag/poll/Settings.tag.html | 57 +++++++++++++--------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html index b675c8d..90ed0c1 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html @@ -52,6 +52,29 @@ <div show={showOptions || !form.creation}> <hr> <div class="form-section"> + <div class="section-title"> + <h4>{__.nav_voteCountingType}</h4> + </div> + <div class="section-content"> + <div class="o-form-element"> + <label class="c-label"> + {__.voteCountingType} + </label> + <select class="c-field" + ref="voteCountingType" + value={form.model.voteCountingType} + disabled={form.hasVotes} + onchange={voteCountingTypeChanged}> + <option each={type in form.voteCountingTypes} + value={type.id}> + {type.name} + </option> + </select> + </div> + </div> + </div> + <hr> + <div class="form-section"> <div class="section-title"> <h4>{__.nav_choices}</h4> </div> @@ -97,7 +120,7 @@ type="datetime-local"> </div> </div> - <div class="o-form-element"> + <div show="{canLimitNumberOfChoices}" class="o-form-element"> <label class="c-toggle c-toggle--info"> {__.limitChoices} <input type="checkbox" @@ -122,6 +145,7 @@ class="c-field" disabled={form.hasVotes} value={form.model.maxChoiceNumber} + min="{form.model.limitChoices ? 1 : 0}" max="{form.choices.length}" type="number"> </div> </div> @@ -129,29 +153,6 @@ <hr> <div class="form-section"> <div class="section-title"> - <h4>{__.nav_voteCountingType}</h4> - </div> - <div class="section-content"> - <div class="o-form-element"> - <label class="c-label"> - {__.voteCountingType} - </label> - <select class="c-field" - ref="voteCountingType" - value={form.model.voteCountingType} - disabled={form.hasVotes} - onchange={voteCountingTypeChanged}> - <option each={type in form.voteCountingTypes} - value={type.id}> - {type.name} - </option> - </select> - </div> - </div> - </div> - <hr> - <div class="form-section"> - <div class="section-title"> <h4>{__.nav_votes}</h4> </div> <div class="section-content"> @@ -288,8 +289,11 @@ this.installBundle(this.session, "poll_settings"); this.form = this.opts.form; + this.showOptions = this.form.showOptions; this.showHelp = false; + this.voteCountingTypes = new Map(this.form.voteCountingTypes.map((t) => [t.id.toString(), t])); + this.canLimitNumberOfChoices = this.voteCountingTypes.get(this.form.model.voteCountingType.toString()).canLimitNumberOfChoices; this.form.model.votePeriod = this.form.model.beginDate || this.form.model.endDate; this.on("mount", () => { @@ -302,6 +306,9 @@ this.toggleLimitChoices = () => { this.form.model.limitChoices = !this.form.model.limitChoices; + if (this.form.model.limitChoices && !this.form.model.maxChoiceNumber) { + this.form.model.maxChoiceNumber = 1; + } }; this.toggleVotePeriod = () => { @@ -326,6 +333,8 @@ this.voteCountingTypeChanged = e => { this.form.model.voteCountingType = e.target.value; + this.canLimitNumberOfChoices = this.voteCountingTypes.get(this.form.model.voteCountingType).canLimitNumberOfChoices; + this.form.model.limitChoices &= this.canLimitNumberOfChoices; }; this.submit = () => { -- 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 aef052cea55ef15be98f2f24ff619c0769a82ec8 Author: Kevin Morin <morin@codelutin.com> Date: Thu Apr 13 17:46:01 2017 +0200 refs #15 ajout de la possibilité ou non de limiter le nombre de choix par vote en fonction du type (+ ajout des bornes min max des valeurs possibles et correction des messages d'erreur) --- .../chorem/pollen/votecounting/VoteCounting.java | 26 +++++++++++++++++++++- .../pollen/votecounting/BordaVoteCounting.java | 15 +++++++++++++ .../pollen-votecounting-borda_en_GB.properties | 2 +- .../pollen-votecounting-borda_fr_FR.properties | 2 +- .../pollen/votecounting/CondorcetVoteCounting.java | 15 +++++++++++++ .../pollen-votecounting-condorcet_en_GB.properties | 2 +- .../pollen-votecounting-condorcet_fr_FR.properties | 2 +- .../pollen/votecounting/CoombsVoteCounting.java | 15 +++++++++++++ .../pollen-votecounting-coombs_en_GB.properties | 2 +- .../pollen-votecounting-coombs_fr_FR.properties | 2 +- .../votecounting/InstantRunoffVoteCounting.java | 17 +++++++++++++- ...en-votecounting-instant-runoff_en_GB.properties | 2 +- ...en-votecounting-instant-runoff_fr_FR.properties | 2 +- .../pollen/votecounting/NormalVoteCounting.java | 15 +++++++++++++ .../pollen/votecounting/NumberVoteCounting.java | 15 +++++++++++++ .../votecounting/PercentageVoteCounting.java | 15 +++++++++++++ 16 files changed, 139 insertions(+), 10 deletions(-) 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 5e91029..b3ec2f2 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 @@ -101,7 +101,7 @@ public interface VoteCounting<S extends VoteCountingStrategy> { * 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 thechoice + * @param choiceName name of the choice * @param voteValue value fo the vote * @return the localized validation message */ @@ -143,4 +143,28 @@ public interface VoteCounting<S extends VoteCountingStrategy> { * @see ChoiceToVoteRenderType */ ChoiceToVoteRenderType getVoteValueEditorType(); + + /** + * Can the creator limit the number of selected choices for a vote? + * It makes sense to limit the number of choice for the normal vote, but not for Condorcet + * + * @return {@code true} if the type of vote counting accept a limited number of choice, {@code false} otherwise. + */ + boolean canLimitNumberOfChoices(); + + /** + * Gets the minimum value for the vote value to be valid. + * If null, then it means no minimum value. + * + * @return the minimum value for the vote to be valid. + */ + Double getMinimumValue(); + + /** + * Gets the maximum value for the vote value to be valid. + * If null, then it means no maximum value. + * + * @return the maximum value for the vote to be valid. + */ + Double getMaximumValue(); } 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 994f7b5..c9168a4 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 @@ -72,6 +72,21 @@ public class BordaVoteCounting extends AbstractVoteCounting<BordaVoteCountingStr } @Override + public boolean canLimitNumberOfChoices() { + return false; + } + + @Override + public Double getMinimumValue() { + return 1d; + } + + @Override + public Double getMaximumValue() { + return null; + } + + @Override public boolean isChoiceInVote(Double voteValue) { return voteValue != null && voteValue > 0 && voteValue < 100; } 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 58d7ad9..1a606a8 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 '%s' of vote for choice %s is not valid, only integer values are authorized. +pollen.error.vote.invalidBordaVoteValue=The value '%2$s' of vote for choice %1$s 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/><a href\='http\://fr.wikipedia.org/wiki/M%C3%A9thode_Borda' target\='\#doc'>More about this method</a> pollen.voteCountingType.borda.shortHelp=Rank choices by preference order from 1 to N (1\=favorite). Only the rank is taken into account, not the values. Two choices can have the same value. 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 1b42bab..2257e7c 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 '%s' pour le choix %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 %1$s 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/><a href\='http\://fr.wikipedia.org/wiki/M%C3%A9thode_Borda' target\='\#doc'>Pour en savoir plus</a> pollen.voteCountingType.borda.shortHelp=Classer les choix par ordre de préférence de 1 à N (1\=préféré). Seul l'ordre des choix compte, peu importe les valeurs. Deux choix peuvent avoir la même valeur. 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 7056eb4..4949d52 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 @@ -72,6 +72,21 @@ public class CondorcetVoteCounting extends AbstractVoteCounting<CondorcetVoteCou } @Override + public boolean canLimitNumberOfChoices() { + return false; + } + + @Override + public Double getMinimumValue() { + return 1d; + } + + @Override + public Double getMaximumValue() { + return null; + } + + @Override public boolean isChoiceInVote(Double voteValue) { 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 f7be8ce..4c6493f 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 '%s' of vote for choice %s is not valid, only integer values are authorized. +pollen.error.vote.invalidCondorcetVoteValue=The value '%2$s' of vote for choice %1$s 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/><a href\='http\://fr.wikipedia.org/wiki/M%C3%A9thode_Condorcet' target\='\#doc'>More about this method</a> pollen.voteCountingType.condorcet.shortHelp=Rank choices by preference order from 1 to N (1\=favorite). Only the rank is taken into account, not the values. Two choices can have the same value. 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 a354014..0482f9d 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 '%s' pour le choix %s n'est pas correcte, seul des valeurs entières sont autorisées. +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.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/><a href\='http\://fr.wikipedia.org/wiki/M%C3%A9thode_Condorcet' target\='\#doc'>Pour en savoir plus</a> pollen.voteCountingType.condorcet.shortHelp=Classer les choix par ordre de préférence de 1 à N (1\=préféré). Seul l'ordre des choix compte, peu importe les valeurs. Deux choix peuvent avoir la même valeur. 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 4a20120..955c546 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 @@ -73,6 +73,21 @@ public class CoombsVoteCounting extends AbstractVoteCounting<CoombsVoteCountingS } @Override + public boolean canLimitNumberOfChoices() { + return false; + } + + @Override + public Double getMinimumValue() { + return 1d; + } + + @Override + public Double getMaximumValue() { + return null; + } + + @Override public boolean isChoiceInVote(Double voteValue) { return voteValue != null && voteValue > 0 && voteValue < 100; } 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 7f96c8e..2f1686e 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 '%s' of vote for choice %s is not valid, only integer values are authorized. +pollen.error.vote.invalidCoombsVoteValue=The value '%2$s' of vote for choice %1$s 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/><a href\='http\://fr.wikipedia.org/wiki/M%C3%A9thode_de_Coombs' target\='\#doc'>More about this method</a> pollen.voteCountingType.coombs.shortHelp=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. 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 9566ccb..d3d9d2a 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 '%s' pour le choix %s n'est pas correcte, seul des valeurs entières sont autorisées. +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.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/><a href\='http\://fr.wikipedia.org/wiki/M%C3%A9thode_de_Coombs' target\='\#doc'>Pour en savoir plus</a> pollen.voteCountingType.coombs.shortHelp=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. 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 3aa8b6b..1fafc24 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 @@ -73,8 +73,23 @@ public class InstantRunoffVoteCounting extends AbstractVoteCounting<InstantRunof } @Override + public boolean canLimitNumberOfChoices() { + return false; + } + + @Override + public Double getMinimumValue() { + return 1d; + } + + @Override + public Double getMaximumValue() { + return null; + } + + @Override public boolean isChoiceInVote(Double voteValue) { - return voteValue != null && voteValue > 0 && voteValue < 100; + return voteValue != null && voteValue > 0; } @Override 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 ce6028c..e363e5f 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 '%s' of vote for choice %s is not valid, only integer values are authorized. +pollen.error.vote.invalidInstantRunoffVoteValue=The value '%2$s' of vote for choice %1$s 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/><a href\='http\://fr.wikipedia.org/wiki/Vote_alternatif' target\='\#doc'>More about this method</a> pollen.voteCountingType.instantRunoff.shortHelp=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. 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 5ab27c6..3e9cac1 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 '%s' pour le choix %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 %1$s 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/><a href\='http\://fr.wikipedia.org/wiki/Vote_alternatif' target\='\#doc'>Pour en savoir plus</a> pollen.voteCountingType.instantRunoff.shortHelp=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. 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 c7a4ffa..c190b7a 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 @@ -67,6 +67,21 @@ public class NormalVoteCounting extends AbstractVoteCounting<NormalVoteCountingS } @Override + public boolean canLimitNumberOfChoices() { + return true; + } + + @Override + public Double getMinimumValue() { + return null; + } + + @Override + public Double getMaximumValue() { + return null; + } + + @Override public boolean isVoteValueValid(Double voteValue) { // no validation on not null vote value return true; 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 9fbb4d8..1c9f5c8 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 @@ -67,6 +67,21 @@ public class NumberVoteCounting extends AbstractVoteCounting<NumberVoteCountingS } @Override + public boolean canLimitNumberOfChoices() { + return true; + } + + @Override + public Double getMinimumValue() { + return null; + } + + @Override + public Double getMaximumValue() { + return null; + } + + @Override public boolean isVoteValueValid(Double voteValue) { // no validation on not null vote value return true; diff --git a/pollen-votecounting-percentage/src/main/java/org/chorem/pollen/votecounting/PercentageVoteCounting.java b/pollen-votecounting-percentage/src/main/java/org/chorem/pollen/votecounting/PercentageVoteCounting.java index 955c6cd..4672d48 100644 --- a/pollen-votecounting-percentage/src/main/java/org/chorem/pollen/votecounting/PercentageVoteCounting.java +++ b/pollen-votecounting-percentage/src/main/java/org/chorem/pollen/votecounting/PercentageVoteCounting.java @@ -69,6 +69,21 @@ public class PercentageVoteCounting extends AbstractVoteCounting<PercentageVoteC } @Override + public boolean canLimitNumberOfChoices() { + return false; + } + + @Override + public Double getMinimumValue() { + return 0d; + } + + @Override + public Double getMaximumValue() { + return 100d; + } + + @Override public boolean isVoteValueValid(Double voteValue) { return voteValue == null || 0 <= voteValue && voteValue <= 100; } -- 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 1ca4434222d76ee47cca65cad7d11a2d818fc10c Author: Kevin Morin <morin@codelutin.com> Date: Thu Apr 13 17:47:54 2017 +0200 refs #15 ajout des nouvelles propriétés des types de vote --- .../pollen/services/bean/VoteCountingTypeBean.java | 30 ++++++++++++++++++++++ .../services/service/VoteCountingTypeService.java | 3 +++ 2 files changed, 33 insertions(+) diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/bean/VoteCountingTypeBean.java b/pollen-services/src/main/java/org/chorem/pollen/services/bean/VoteCountingTypeBean.java index cdf6d48..b5ee6b9 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/bean/VoteCountingTypeBean.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/bean/VoteCountingTypeBean.java @@ -41,6 +41,12 @@ public class VoteCountingTypeBean { protected String renderType; + protected boolean canLimitNumberOfChoices; + + protected Double minimumValue; + + protected Double maximumValue; + public int getId() { return id; @@ -93,4 +99,28 @@ public class VoteCountingTypeBean { break; } } + + public boolean isCanLimitNumberOfChoices() { + return canLimitNumberOfChoices; + } + + public void setCanLimitNumberOfChoices(boolean canLimitNumberOfChoices) { + this.canLimitNumberOfChoices = canLimitNumberOfChoices; + } + + public Double getMinimumValue() { + return minimumValue; + } + + public void setMinimumValue(Double minimumValue) { + this.minimumValue = minimumValue; + } + + public Double getMaximumValue() { + return maximumValue; + } + + public void setMaximumValue(Double maximumValue) { + this.maximumValue = maximumValue; + } } diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteCountingTypeService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteCountingTypeService.java index 5a196f8..656c981 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteCountingTypeService.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteCountingTypeService.java @@ -74,6 +74,9 @@ public class VoteCountingTypeService extends PollenServiceSupport { newVoteCountingType.setHelper(voteCounting.getHelp(l)); newVoteCountingType.setShortHelper(voteCounting.getShortHelp(l)); newVoteCountingType.setRenderType(voteCounting.getVoteValueEditorType()); + newVoteCountingType.setCanLimitNumberOfChoices(voteCounting.canLimitNumberOfChoices()); + newVoteCountingType.setMinimumValue(voteCounting.getMinimumValue()); + newVoteCountingType.setMaximumValue(voteCounting.getMaximumValue()); return newVoteCountingType; } -- 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 e1b985f05c79117284ca99a238e41b01a16dd680 Author: Kevin Morin <morin@codelutin.com> Date: Thu Apr 13 17:48:45 2017 +0200 Conversion des chaines vides en Double null (pour les votes) --- .../src/main/java/org/chorem/pollen/rest/api/JsonHelper.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/JsonHelper.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/JsonHelper.java index 1afee10..b305dd5 100644 --- a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/JsonHelper.java +++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/JsonHelper.java @@ -32,7 +32,7 @@ import com.google.gson.JsonNull; import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; import com.google.gson.JsonSerializer; -import org.apache.commons.lang3.ObjectUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import org.chorem.pollen.services.bean.PollenEntityId; import org.chorem.pollen.services.bean.PollenEntityRef; @@ -208,6 +208,16 @@ public class JsonHelper { }); + gsonBuilder.registerTypeAdapter(Double.class, (JsonDeserializer<Double>) (json, typeOfT, context) -> { + Double result; + if (StringUtils.isEmpty(json.getAsString())) { + result = null; + } else { + result = json.getAsDouble(); + } + return result; + }); + if (prettyPrint) { gsonBuilder.setPrettyPrinting(); -- 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 7898850c9790be0d5b99c4ee2085233c20fd91ad Author: Kevin Morin <morin@codelutin.com> Date: Thu Apr 13 17:49:24 2017 +0200 refs #15 prise en compte de la limite de choix par vote + gestion des erreurs sur le vote --- pollen-ui-riot-js/src/main/web/i18n.json | 2 + .../src/main/web/tag/poll/Votes.tag.html | 83 +++++++++++++++------- 2 files changed, 61 insertions(+), 24 deletions(-) diff --git a/pollen-ui-riot-js/src/main/web/i18n.json b/pollen-ui-riot-js/src/main/web/i18n.json index dfcb593..946913f 100644 --- a/pollen-ui-riot-js/src/main/web/i18n.json +++ b/pollen-ui-riot-js/src/main/web/i18n.json @@ -64,6 +64,7 @@ "poll_votes_deleteVote": "Supprimer le vote ?", "poll_votes_authorPlaceHolder": "Renseignez votre nom", "poll_votes_toVote": "Voter", + "poll_votes_tooManyChoicesSelected": "Vous avez sélectionné trop de choix. Maximum :", "poll_votes_addChoice": "Ajouter un choix", "poll_votes_choices": "Choix", "poll_votes_delete": "Supprimer le vote ?", @@ -416,6 +417,7 @@ "poll_votes_deleteVote": "Delete vote?", "poll_votes_authorPlaceHolder": "Fill your name", "poll_votes_toVote": "Vote", + "poll_votes_tooManyChoicesSelected": "You selected too many choices. Maximum:", "poll_votes_addChoice": "Add choice", "poll_votes_choices": "Choices", "poll_votes_delete": "Delete vote?", diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html index e47b697..daf7f48 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html @@ -14,7 +14,7 @@ require("./Podium.tag.html"); <div class="o-field o-field--icon-left o-field--icon-right" if={poll.canVote} > <i class="fa fa-fw fa-user c-icon"></i> - <input class="c-field {c-field--error: !voteId && error['voter.name']}" + <input class="c-field {c-field--error: !voteId && error && error['voter.name']}" type="text" ref="voterName" name="voterName" @@ -23,10 +23,6 @@ require("./Podium.tag.html"); placeholder={__.authorPlaceHolder} value={userName}> </div> - <div class="c-hint--static c-hint--error" - if={!voteId && error['voter.name']}> - {error['voter.name']} - </div> <div if={!poll.canVote} class="choices-label"> {__.choices} @@ -41,13 +37,15 @@ require("./Podium.tag.html"); <input if={poll.voteCountingTypeValue.renderType==='checkbox'} class="check" type="checkbox" + onchange="{onVoteChanged}" ref="{choice.id}_voteValue" disabled={voteId}> <input if={poll.voteCountingTypeValue.renderType==='text'} - class="text c-field" + class="text c-field {c-field--error: !voteId && error && error['vote.voteValue#' + choice.id]}" type="number" - required={!voteId} - min="1" + min="{poll.voteCountingTypeValue.minimumValue}" + max="{poll.voteCountingTypeValue.maximumValue}" + onchange="{onVoteChanged}" ref="{choice.id}_voteValue" disabled={voteId}> </div> @@ -57,10 +55,19 @@ require("./Podium.tag.html"); class="c-button c-button--brand pull-right" type="submit" name="newVote" - disabled={voteId}> + disabled={voteId || tooManyChoicesSelected}> {__.toVote} </button> </div> + <div class="c-hint--static c-hint--error" if="{!voteId && tooManyChoicesSelected}"> + {__.tooManyChoicesSelected} {poll.maxChoiceNumber} + </div> + <div class="c-hint--static c-hint--error" if="{!voteId && error}"> + <div each={fields in error}> + {fields} + </div> + </div> + </form> <div class="window"> <div class="frame"> @@ -95,7 +102,7 @@ require("./Podium.tag.html"); <form if={showVotes} each={vote in poll.votes} class="vote" onsubmit="{updateVote(vote)}"> <div class="voter"> <span class="voter-name" - if={vote.id !== voteId}> + if="{vote.id !== voteId}"> <i class="fa fa-user"/> {vote.voterName} </span> @@ -105,32 +112,29 @@ require("./Podium.tag.html"); <input ref="vote_{vote.id}_voter" name="vote_{vote.id}_voter" type="text" - class="c-field {c-field--error: error['voter.name']}" + class="c-field {c-field--error: error && error['voter.name']}" value="{vote.voterName}" required={vote.id === voteId} disabled={vote.id !== voteId} placeholder="{__.authorPlaceHolder}"> </div> - <div class="c-hint--static c-hint--error" - if={vote.id === voteId && error['voter.name']}> - {error['voter.name']} - </div> </div> <div each={choice in poll.choices} class="vote-choice" > <input if={poll.voteCountingTypeValue.renderType==='checkbox' && (poll.getVoteChoice(vote, choice) || voteId === vote.id)} ref="vote_{vote.id}_{choice.id}" name="vote_{vote.id}_{choice.id}" - class="check" + class="check {c-field--error: vote.id === voteId && error && error['vote.voteValue#' + choice.id]}" type="checkbox" checked={poll.getVoteValue(vote, choice) == 1} disabled={voteId !== vote.id}> <input if={poll.voteCountingTypeValue.renderType === 'text' && (poll.getVoteChoice(vote, choice) || voteId === vote.id)} ref="vote_{vote.id}_{choice.id}" - class="text c-field" + class="text c-field {c-field--error: vote.id === voteId && error && error['vote.voteValue#' + choice.id]}" name="vote_{vote.id}_{choice.id}" type="number" + min="{poll.voteCountingTypeValue.minimumValue}" + max="{poll.voteCountingTypeValue.maximumValue}" required={vote.id === voteId} - min="1" disabled={voteId !== vote.id} value={poll.getVoteValue(vote, choice)}> </div> @@ -162,6 +166,14 @@ require("./Podium.tag.html"); </button> </span> </div> + <div class="c-hint--static c-hint--error" if="{vote.id === voteId && tooManyChoicesSelected}"> + {__.tooManyChoicesSelected} {poll.maxChoiceNumber} + </div> + <div class="c-hint--static c-hint--error" if="{vote.id === voteId && error}"> + <div each={fields in error}> + {fields} + </div> + </div> </form> </div> </div> @@ -198,6 +210,7 @@ require("./Podium.tag.html"); this.installBundle(session, "poll_votes"); let user = session.getUser(); this.userName = user && user.name; + this.tooManyChoicesSelected = false; this.poll = require("../../js/Poll.js"); this.poll.loadVotes(); @@ -207,6 +220,7 @@ require("./Podium.tag.html"); this.loaded = poll.choices !== undefined; this.poll = poll; this.choiceToAdd = this.poll.initChoice(this.choiceToAdd); + this.onVoteChanged(); this.update(); }; @@ -214,33 +228,51 @@ require("./Podium.tag.html"); this.showVotes = false; this.voteId = null; - this.error = {}; + this.error = null; this.cancelEditVote = vote => () => { this.voteId = null; vote.choice.forEach(c => { - if (this.poll.voteCountingTypeValuerenderType === "text") { + if (this.poll.voteCountingTypeValue.renderType === "text") { this.refs["vote_" + vote.id + "_" + c.choiceId].value = c.voteValue; } else { this.refs["vote_" + vote.id + "_" + c.choiceId].checked = c.voteValue === 1 ? "checked" : ""; } }); - this.error = {}; + this.error = null; }; this.onEditVote = (vote) => () => { this.voteId = vote.id; - this.error = {}; + this.error = null; }; this.getChoiceVoteValue = ref => { let input = this.refs[ref]; + if (!input) { + return 0; + } if (this.poll.voteCountingTypeValue.renderType === "text") { return input.value; } return input.checked ? 1 : 0; }; + this.onVoteChanged = () => { + if (this.loaded && this.poll.maxChoiceNumber) { + var selectedChoiceNb = 0; + this.poll.choices.forEach(c => { + var choiceValue = this.getChoiceVoteValue(c.id + "_voteValue"); + if (choiceValue && choiceValue !== '0') { + selectedChoiceNb++; + } + }); + this.tooManyChoicesSelected = selectedChoiceNb > this.poll.maxChoiceNumber; + } else { + this.tooManyChoicesSelected = false; + } + }; + this.addVote = (e) => { e.preventDefault(); e.stopPropagation(); @@ -269,7 +301,8 @@ require("./Podium.tag.html"); } }); } - this.error = {}; + this.selectedChoiceNb = 0; + this.error = null; if (this.poll.resultIsVisible) { this.poll.loadResults().then(() => { this.update(); @@ -302,7 +335,8 @@ require("./Podium.tag.html"); }); this.poll.updateVote(updateVote).then(() => { this.voteId = null; - this.error = {}; + this.selectedChoiceNb = 0; + this.error = null; if (this.poll.resultIsVisible) { this.poll.loadResults().then(() => { this.update(); @@ -324,6 +358,7 @@ require("./Podium.tag.html"); if (response) { this.poll.deleteVote(vote) .then(() => { + this.selectedChoiceNb = 0; this.update(); }); } -- 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 e3445feac5975f411a283379a095d631d67365d1 Author: Kevin Morin <morin@codelutin.com> Date: Thu Apr 13 17:50:47 2017 +0200 Gestion des messages d'erreur de vote dans les types de vote --- .../pollen/services/service/PollService.java | 5 +++-- .../services/service/VoteCountingService.java | 22 +++++++++++++--------- .../pollen/services/service/VoteService.java | 11 +++++++---- .../i18n/pollen-services_fr_FR.properties | 14 +++++++------- 4 files changed, 30 insertions(+), 22 deletions(-) diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollService.java index 1a27750..2a11fbf 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollService.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollService.java @@ -229,8 +229,9 @@ public class PollService extends PollenServiceSupport { if (PollType.FREE.equals(poll.getPollType()) ) { Poll pollDb = getPoll0(poll.getEntityId()); newParticipants.addAll(Sets.newHashSet(poll.getParticipants())); - if (pollDb.getParticipants() != null) { - newParticipants.removeAll(Sets.newHashSet(pollDb.getParticipants().split("\\s+"))); + String participantsDb = pollDb.getParticipants(); + if (participantsDb != null) { + newParticipants.removeAll(Sets.newHashSet(participantsDb.split("\\s+"))); } } 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 6606d20..3e86bb9 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 @@ -29,6 +29,7 @@ import org.chorem.pollen.persistence.entity.Vote; import org.chorem.pollen.persistence.entity.VoteToChoice; import org.chorem.pollen.persistence.entity.VoterList; import org.chorem.pollen.persistence.entity.VoterListMember; +import org.chorem.pollen.services.bean.ChoiceBean; import org.chorem.pollen.services.bean.GroupVoteCountingResultBean; import org.chorem.pollen.services.bean.VoteBean; import org.chorem.pollen.services.bean.VoteCountingResultBean; @@ -48,8 +49,7 @@ import org.chorem.pollen.votecounting.model.VoterBuilder; import java.util.List; import java.util.Map; import java.util.Set; - -import static org.nuiton.i18n.I18n.l; +import java.util.stream.Collectors; /** * TODO @@ -245,13 +245,15 @@ public class VoteCountingService extends PollenServiceSupport { } - protected ErrorMap voteIsValid(VoteBean vote, VoteCounting voteCounting) { + protected ErrorMap voteIsValid(VoteBean vote, VoteCounting voteCounting, List<ChoiceBean> choices) { ErrorMap errors = new ErrorMap(); + Map<String, String> choiceNamesById = choices.stream().collect(Collectors.toMap(ChoiceBean::getEntityId, ChoiceBean::getChoiceValue)); Double total = null; for (VoteToChoiceBean choice : vote.getChoice()) { - if (voteCounting.isVoteValueNull(choice.getVoteValue())) { + Double voteValue = choice.getVoteValue(); + if (voteCounting.isVoteValueNull(voteValue)) { continue; } @@ -259,18 +261,20 @@ public class VoteCountingService extends PollenServiceSupport { total = 0.0; } - total += choice.getVoteValue(); + total += voteValue; check(errors, - "voteValue[" + choice.getChoiceId().getReducedId() + "]", - voteCounting.isVoteValueValid(choice.getVoteValue()), - l(getLocale(), "pollen.error.vote.voteValue.invalid")); + "voteValue#" + choice.getChoiceId().getReducedId(), + voteCounting.isVoteValueValid(voteValue), + voteCounting.getVoteValueNotValidMessage(getLocale(), + choiceNamesById.get(choice.getChoiceId().getEntityId()), + voteValue == null ? "" : voteValue.toString())); } check(errors, "totalVoteValue", voteCounting.isTotalVoteValueValid(total), - l(getLocale(), "pollen.error.vote.totalVote.invalid")); + voteCounting.getTotalVoteValueNotValidMessage(getLocale())); return errors; } 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 7c2890c..f25f779 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 @@ -32,6 +32,7 @@ import org.chorem.pollen.persistence.entity.VoteToChoice; import org.chorem.pollen.persistence.entity.VoteToChoiceTopiaDao; import org.chorem.pollen.persistence.entity.VoterList; import org.chorem.pollen.persistence.entity.VoterListMember; +import org.chorem.pollen.services.bean.ChoiceBean; import org.chorem.pollen.services.bean.PollenEntityRef; import org.chorem.pollen.services.bean.VoteBean; import org.chorem.pollen.services.bean.VoteToChoiceBean; @@ -128,8 +129,9 @@ public class VoteService extends PollenServiceSupport { checkPermission(PermissionVerb.addVote, pollId); Poll poll = getPollService().getPoll0(pollId); + List<ChoiceBean> choices = getChoiceService().getChoices(pollId); - ErrorMap errorMap = checkVote(poll, vote); + ErrorMap errorMap = checkVote(poll, vote, choices); errorMap.failIfNotEmpty(); Vote result = saveVote(poll, vote); @@ -148,8 +150,9 @@ public class VoteService extends PollenServiceSupport { checkPermission(PermissionVerb.editVote, vote.getEntityId()); Poll poll = getPollService().getPoll0(pollId); + List<ChoiceBean> choices = getChoiceService().getChoices(pollId); - ErrorMap errorMap = checkVote(poll, vote); + ErrorMap errorMap = checkVote(poll, vote, choices); errorMap.failIfNotEmpty(); Vote result = saveVote(poll, vote); @@ -178,7 +181,7 @@ public class VoteService extends PollenServiceSupport { } - protected ErrorMap checkVote(Poll poll, VoteBean vote) { + protected ErrorMap checkVote(Poll poll, VoteBean vote, List<ChoiceBean> choices) { ErrorMap errors = new ErrorMap(); @@ -219,7 +222,7 @@ public class VoteService extends PollenServiceSupport { VoteCounting voteCounting = getVoteCountingService().getVoteCounting(poll); - ErrorMap valueErrors = getVoteCountingService().voteIsValid(vote, voteCounting); + ErrorMap valueErrors = getVoteCountingService().voteIsValid(vote, voteCounting, choices); valueErrors.copyTo(errors, "vote."); if (poll.getMaxChoiceNumber() > 0) { 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 a393d88..e03330f 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 @@ -73,15 +73,15 @@ 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.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 invalid -pollen.error.vote.voterName.alreadyExist=le nom existe déjà -pollen.error.vote.voterName.mandatory=le nom est obligatoire +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 +pollen.error.vote.voterName.alreadyExist=Le nom existe déjà +pollen.error.vote.voterName.mandatory=Le nom est obligatoire pollen.error.voterList.member.email.alreadyUsed=L'email du membre est déjà utilisé dans cette liste pollen.error.voterList.member.email.invalid=L'email du membre est invalide -pollen.error.voterList.member.email.mandatory=l'email du membre est obligatoire -pollen.error.voterList.member.mandatory=la liste de votant doit comporter au moins un membre +pollen.error.voterList.member.email.mandatory=L'email du membre est obligatoire +pollen.error.voterList.member.mandatory=La liste de votant doit comporter au moins un membre pollen.error.voterList.member.name.alreadyUsed=Le nom du membre est déjà utilisé pollen.error.voterList.member.name.mandatory=Le nom du membre est obligatoire pollen.error.voterList.member.weight.greaterThan0=Le membre doit avoir un poid supérieur à 0 -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm