branch feature/multi-ui updated (7c1b6527 -> a66db7ec)
This is an automated email from the git hooks/post-receive script. New change to branch feature/multi-ui in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git from 7c1b6527 update gitlab-ci to genarate feature registry new a66db7ec fixes #254 - Ajouter un nombre minimum de choix pour obliger les gens à voter 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 a66db7ec1a6f4b83d83cf053a3a59e26384460dc Author: jcouteau <couteau@codelutin.com> Date: Thu Dec 19 17:18:06 2019 +0100 fixes #254 - Ajouter un nombre minimum de choix pour obliger les gens à voter Summary of changes: .../converter/VoteCountingConfigDeserializer.java | 25 +++++++++++++---- pollen-ui-riot-js/src/main/web/i18n/fr.json | 1 + .../src/main/web/tag/poll/EditVote.tag.html | 6 ++-- .../MaxChoicesNumberConfig.tag.html | 32 ++++++++++++++++++++-- ....java => AbstractVoteCountingMinMaxChoice.java} | 19 +++++++++++-- ...rConfig.java => MinMaxChoicesNumberConfig.java} | 11 +++++++- .../i18n/pollen-votecounting-api_en_GB.properties | 1 + .../i18n/pollen-votecounting-api_fr_FR.properties | 3 +- .../chorem/pollen/votecounting/BordaConfig.java | 4 +-- .../pollen/votecounting/BordaVoteCounting.java | 2 +- .../pollen/votecounting/NormalVoteCounting.java | 6 ++-- .../votecounting/NormalVoteCountingStrategy.java | 4 +-- .../NormalVoteCountingStrategyTest.java | 4 +-- .../pollen/votecounting/NumberVoteCounting.java | 6 ++-- .../votecounting/NumberVoteCountingStrategy.java | 4 +-- .../NumberVoteCountingStrategyTest.java | 4 +-- 16 files changed, 99 insertions(+), 33 deletions(-) rename pollen-votecounting-api/src/main/java/org/chorem/pollen/votecounting/{AbstractVoteCountingMaxChoice.java => AbstractVoteCountingMinMaxChoice.java} (65%) rename pollen-votecounting-api/src/main/java/org/chorem/pollen/votecounting/model/{MaxChoicesNumberConfig.java => MinMaxChoicesNumberConfig.java} (78%) -- 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 feature/multi-ui in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit a66db7ec1a6f4b83d83cf053a3a59e26384460dc Author: jcouteau <couteau@codelutin.com> Date: Thu Dec 19 17:18:06 2019 +0100 fixes #254 - Ajouter un nombre minimum de choix pour obliger les gens à voter --- .../converter/VoteCountingConfigDeserializer.java | 25 +++++++++++++---- pollen-ui-riot-js/src/main/web/i18n/fr.json | 1 + .../src/main/web/tag/poll/EditVote.tag.html | 6 ++-- .../MaxChoicesNumberConfig.tag.html | 32 ++++++++++++++++++++-- ....java => AbstractVoteCountingMinMaxChoice.java} | 19 +++++++++++-- ...rConfig.java => MinMaxChoicesNumberConfig.java} | 11 +++++++- .../i18n/pollen-votecounting-api_en_GB.properties | 1 + .../i18n/pollen-votecounting-api_fr_FR.properties | 3 +- .../chorem/pollen/votecounting/BordaConfig.java | 4 +-- .../pollen/votecounting/BordaVoteCounting.java | 2 +- .../pollen/votecounting/NormalVoteCounting.java | 6 ++-- .../votecounting/NormalVoteCountingStrategy.java | 4 +-- .../NormalVoteCountingStrategyTest.java | 4 +-- .../pollen/votecounting/NumberVoteCounting.java | 6 ++-- .../votecounting/NumberVoteCountingStrategy.java | 4 +-- .../NumberVoteCountingStrategyTest.java | 4 +-- 16 files changed, 99 insertions(+), 33 deletions(-) diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/converter/VoteCountingConfigDeserializer.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/converter/VoteCountingConfigDeserializer.java index 0ab65d5c..ef4fe57e 100644 --- a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/converter/VoteCountingConfigDeserializer.java +++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/converter/VoteCountingConfigDeserializer.java @@ -28,7 +28,7 @@ import org.chorem.pollen.votecounting.BordaConfig; import org.chorem.pollen.votecounting.CumulativeConfig; import org.chorem.pollen.votecounting.MajorityJudgmentConfig; import org.chorem.pollen.votecounting.model.EmptyVoteCountingConfig; -import org.chorem.pollen.votecounting.model.MaxChoicesNumberConfig; +import org.chorem.pollen.votecounting.model.MinMaxChoicesNumberConfig; import org.chorem.pollen.votecounting.model.VoteCountingConfig; import java.io.IOException; @@ -46,7 +46,7 @@ public class VoteCountingConfigDeserializer extends JsonDeserializer<VoteCountin VoteCountingConfig config; - if (configTemp.getMaxChoiceNumber() != null) { + if (configTemp.getMaxChoiceNumber() != null || configTemp.getMinChoiceNumber() != null) { if (configTemp.getPointsByRank() != null) { @@ -57,9 +57,14 @@ public class VoteCountingConfigDeserializer extends JsonDeserializer<VoteCountin } else { - MaxChoicesNumberConfig maxChoicesNumberConfig = new MaxChoicesNumberConfig(); - maxChoicesNumberConfig.setMaxChoiceNumber(configTemp.getMaxChoiceNumber()); - config = maxChoicesNumberConfig; + MinMaxChoicesNumberConfig minMaxChoicesNumberConfig = new MinMaxChoicesNumberConfig(); + if (configTemp.getMaxChoiceNumber() != null) { + minMaxChoicesNumberConfig.setMaxChoiceNumber(configTemp.getMaxChoiceNumber()); + } + if (configTemp.getMinChoiceNumber() != null) { + minMaxChoicesNumberConfig.setMinChoiceNumber(configTemp.getMinChoiceNumber()); + } + config = minMaxChoicesNumberConfig; } } else if (configTemp.getPoints() != null) { @@ -87,6 +92,8 @@ public class VoteCountingConfigDeserializer extends JsonDeserializer<VoteCountin protected Integer maxChoiceNumber; + protected Integer minChoiceNumber; + protected List<Integer> pointsByRank; protected Integer points; @@ -101,6 +108,14 @@ public class VoteCountingConfigDeserializer extends JsonDeserializer<VoteCountin this.maxChoiceNumber = maxChoiceNumber; } + public Integer getMinChoiceNumber() { + return minChoiceNumber; + } + + public void setMinChoiceNumber(Integer minChoiceNumber) { + this.minChoiceNumber = minChoiceNumber; + } + public List<Integer> getPointsByRank() { return pointsByRank; } diff --git a/pollen-ui-riot-js/src/main/web/i18n/fr.json b/pollen-ui-riot-js/src/main/web/i18n/fr.json index a3e35f3b..0f836585 100644 --- a/pollen-ui-riot-js/src/main/web/i18n/fr.json +++ b/pollen-ui-riot-js/src/main/web/i18n/fr.json @@ -377,6 +377,7 @@ "poll_settings_addChoices": "Ajout de choix par les participants", "poll_settings_voteCountingConfig_limitChoices": "Limiter le nombre de choix par vote", "poll_settings_voteCountingConfig_maxChoiceNumber": "Nombre maximum de choix", + "poll_settings_voteCountingConfig_minChoiceNumber": "Nombre minimum de choix", "poll_settings_voteCountingConfig_bordaDefault": "Répartition des points par défaut", "poll_settings_voteCountingConfig_pointsByRank": "Nombre de points distribués par rang", "poll_settings_voteCountingConfig_rank": "Rang", 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 90e852aa..1d86ee39 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 @@ -284,16 +284,16 @@ vote.choice.forEach(choice => { let input = this.refs[choice.choiceId + "_voteValue"]; if (input) { - if (this.question.voteCountingTypeValue.renderType === "text") { + if (this.question.voteCountingTypeValue && this.question.voteCountingTypeValue.renderType === "text") { input.value = choice.voteValue; - } else if (this.question.voteCountingTypeValue.renderType === "select") { + } else if (this.question.voteCountingTypeValue && this.question.voteCountingTypeValue.renderType === "select") { input.forEach(option => {option.selected = option.value === choice.voteValue + "";}); } else { input.checked = choice.voteValue === 1; } } }); - if (this.question.voteCountingTypeValue.renderType === "select") { + if (this.question.voteCountingTypeValue && this.question.voteCountingTypeValue.renderType === "select") { this.refs[this.question.choices[0].id + "_voteValue"][0].parentNode.focus(); } else { this.refs[this.question.choices[0].id + "_voteValue"].focus(); diff --git a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/MaxChoicesNumberConfig.tag.html b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/MaxChoicesNumberConfig.tag.html index 78581f86..86c19d53 100644 --- a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/MaxChoicesNumberConfig.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/MaxChoicesNumberConfig.tag.html @@ -26,10 +26,10 @@ id="limitChoices" ref="limitChoices" disabled={opts.disabled} - checkboxchecked={config.maxChoiceNumber > 0} + checkboxchecked={config.maxChoiceNumber > 0 || config.minChoiceNumber > 0} ontogglecheckbox={toggleLimitChoices}/> </div> - <div show={config.maxChoiceNumber > 0} class="o-form-element"> + <div show={config.maxChoiceNumber > 0 || config.minChoiceNumber > 0 } class="o-form-element"> <label class="c-label" for="maxChoiceNumber"> {_t.maxChoiceNumber} </label> @@ -43,6 +43,19 @@ min="1" max="{opts.countChoices}" type="number" onchange={maxChoiceNumberChange}> + <label class="c-label" for="minChoiceNumber"> + {_t.minChoiceNumber} + </label> + <input name="minChoiceNumber" + tabindex="1" + id="minChoiceNumber" + ref="minChoiceNumber" + class="c-field c-field--label" + disabled={opts.disabled} + value={Math.max(1, opts.config.minChoiceNumber)} + min="1" max="{opts.countChoices}" + type="number" + onchange={minChoiceNumberChange}> </div> <script type="es6"> @@ -58,6 +71,11 @@ } else { this.config.maxChoiceNumber = 0; } + if (this.opts.config.minChoiceNumber === 0) { + this.opts.config.minChoiceNumber = 1; + } else { + this.opts.config.minChoiceNumber = 0; + } if (this.opts.onchange) { this.opts.onchange(); } @@ -71,9 +89,17 @@ } }; + this.minChoiceNumberChange = () => { + this.opts.config.minChoiceNumber = this.refs.minChoiceNumber.valueAsNumber; + if (this.opts.onchange) { + this.opts.onchange(); + } + }; + this.getConfig = () => { return { - maxChoiceNumber: this.refs.limitChoices.checked ? this.refs.maxChoiceNumber.valueAsNumber : 0 + maxChoiceNumber: this.refs.limitChoices.checked ? this.refs.maxChoiceNumber.valueAsNumber : 0, + minChoiceNumber: this.refs.limitChoices.checked ? this.refs.minChoiceNumber.valueAsNumber : 0 }; }; diff --git a/pollen-votecounting-api/src/main/java/org/chorem/pollen/votecounting/AbstractVoteCountingMaxChoice.java b/pollen-votecounting-api/src/main/java/org/chorem/pollen/votecounting/AbstractVoteCountingMinMaxChoice.java similarity index 65% rename from pollen-votecounting-api/src/main/java/org/chorem/pollen/votecounting/AbstractVoteCountingMaxChoice.java rename to pollen-votecounting-api/src/main/java/org/chorem/pollen/votecounting/AbstractVoteCountingMinMaxChoice.java index 603ea480..bfb7ed79 100644 --- a/pollen-votecounting-api/src/main/java/org/chorem/pollen/votecounting/AbstractVoteCountingMaxChoice.java +++ b/pollen-votecounting-api/src/main/java/org/chorem/pollen/votecounting/AbstractVoteCountingMinMaxChoice.java @@ -22,17 +22,17 @@ package org.chorem.pollen.votecounting; */ import com.google.common.collect.Multimap; -import org.chorem.pollen.votecounting.model.MaxChoicesNumberConfig; +import org.chorem.pollen.votecounting.model.MinMaxChoicesNumberConfig; import org.chorem.pollen.votecounting.model.Voter; import java.util.Locale; import static org.nuiton.i18n.I18n.l; -public abstract class AbstractVoteCountingMaxChoice<S extends VoteCountingStrategy<C>, C extends MaxChoicesNumberConfig> extends AbstractVoteCounting<S, C> { +public abstract class AbstractVoteCountingMinMaxChoice<S extends VoteCountingStrategy<C>, C extends MinMaxChoicesNumberConfig> extends AbstractVoteCounting<S, C> { - protected AbstractVoteCountingMaxChoice(int id, Class<S> strategyType, Class<C> configType, String i18nName, String i18nShortHelp, String i18nHelp) { + protected AbstractVoteCountingMinMaxChoice(int id, Class<S> strategyType, Class<C> configType, String i18nName, String i18nShortHelp, String i18nHelp) { super(id, strategyType, configType, i18nName, i18nShortHelp, i18nHelp); } @@ -40,6 +40,7 @@ public abstract class AbstractVoteCountingMaxChoice<S extends VoteCountingStrate public Multimap<String, String> checkVote(Voter vote, C config, Locale locale) { Multimap<String, String> errorMap = super.checkVote(vote, config, locale); + //Check max if (config.getMaxChoiceNumber() > 0) { long nbChoice = vote.getVoteForChoices() .stream() @@ -51,6 +52,18 @@ public abstract class AbstractVoteCountingMaxChoice<S extends VoteCountingStrate } + //Check min + if (config.getMinChoiceNumber() > 0) { + long nbChoice = vote.getVoteForChoices() + .stream() + .filter(voteForChoice -> voteForChoice.getVoteValue() != null && voteForChoice.getVoteValue() != 0) + .count(); + if (nbChoice < config.getMinChoiceNumber()) { + errorMap.put("choices", l(locale, "pollen.voteCountingType.minChoices.error.overflow")); + } + + } + return errorMap; } } diff --git a/pollen-votecounting-api/src/main/java/org/chorem/pollen/votecounting/model/MaxChoicesNumberConfig.java b/pollen-votecounting-api/src/main/java/org/chorem/pollen/votecounting/model/MinMaxChoicesNumberConfig.java similarity index 78% rename from pollen-votecounting-api/src/main/java/org/chorem/pollen/votecounting/model/MaxChoicesNumberConfig.java rename to pollen-votecounting-api/src/main/java/org/chorem/pollen/votecounting/model/MinMaxChoicesNumberConfig.java index a89485d2..278cc157 100644 --- a/pollen-votecounting-api/src/main/java/org/chorem/pollen/votecounting/model/MaxChoicesNumberConfig.java +++ b/pollen-votecounting-api/src/main/java/org/chorem/pollen/votecounting/model/MinMaxChoicesNumberConfig.java @@ -24,9 +24,10 @@ package org.chorem.pollen.votecounting.model; /** * @author Sylvain Bavencoff - bavencoff@codelutin.com */ -public class MaxChoicesNumberConfig implements VoteCountingConfig { +public class MinMaxChoicesNumberConfig implements VoteCountingConfig { protected int maxChoiceNumber; + protected int minChoiceNumber; public int getMaxChoiceNumber() { return maxChoiceNumber; @@ -35,4 +36,12 @@ public class MaxChoicesNumberConfig implements VoteCountingConfig { public void setMaxChoiceNumber(int maxChoiceNumber) { this.maxChoiceNumber = maxChoiceNumber; } + + public int getMinChoiceNumber() { + return minChoiceNumber; + } + + public void setMinChoiceNumber(int minChoiceNumber) { + this.minChoiceNumber = minChoiceNumber; + } } diff --git a/pollen-votecounting-api/src/main/resources/i18n/pollen-votecounting-api_en_GB.properties b/pollen-votecounting-api/src/main/resources/i18n/pollen-votecounting-api_en_GB.properties index 5c29547d..9f785b6a 100644 --- a/pollen-votecounting-api/src/main/resources/i18n/pollen-votecounting-api_en_GB.properties +++ b/pollen-votecounting-api/src/main/resources/i18n/pollen-votecounting-api_en_GB.properties @@ -1,2 +1,3 @@ pollen.voteCountingType.help=%s Vote\: %s pollen.voteCountingType.maxChoices.error.overflow=Too many choices +pollen.voteCountingType.minChoices.error.overflow=Not enough choices diff --git a/pollen-votecounting-api/src/main/resources/i18n/pollen-votecounting-api_fr_FR.properties b/pollen-votecounting-api/src/main/resources/i18n/pollen-votecounting-api_fr_FR.properties index c01cc713..18a8ad6d 100644 --- a/pollen-votecounting-api/src/main/resources/i18n/pollen-votecounting-api_fr_FR.properties +++ b/pollen-votecounting-api/src/main/resources/i18n/pollen-votecounting-api_fr_FR.properties @@ -1,2 +1,3 @@ pollen.voteCountingType.help=Méthode %s \: %s -pollen.voteCountingType.maxChoices.error.overflow=Le nombre de choix maximal atteind +pollen.voteCountingType.maxChoices.error.overflow=Le nombre de choix maximal est dépassé +pollen.voteCountingType.minChoices.error.overflow=Le nombre de choix minimum n'est pas atteint diff --git a/pollen-votecounting-borda/src/main/java/org/chorem/pollen/votecounting/BordaConfig.java b/pollen-votecounting-borda/src/main/java/org/chorem/pollen/votecounting/BordaConfig.java index 5086be3f..2434e06e 100644 --- a/pollen-votecounting-borda/src/main/java/org/chorem/pollen/votecounting/BordaConfig.java +++ b/pollen-votecounting-borda/src/main/java/org/chorem/pollen/votecounting/BordaConfig.java @@ -21,14 +21,14 @@ package org.chorem.pollen.votecounting; * #L% */ -import org.chorem.pollen.votecounting.model.MaxChoicesNumberConfig; +import org.chorem.pollen.votecounting.model.MinMaxChoicesNumberConfig; import java.util.List; /** * @author Sylvain Bavencoff - bavencoff@codelutin.com */ -public class BordaConfig extends MaxChoicesNumberConfig { +public class BordaConfig extends MinMaxChoicesNumberConfig { protected List<Integer> pointsByRank; 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 82eaf891..43def19e 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 @@ -36,7 +36,7 @@ import static org.nuiton.i18n.I18n.n; * @author Tony Chemit - dev@tchemit.fr * @since 1.6 */ -public class BordaVoteCounting extends AbstractVoteCountingMaxChoice<BordaVoteCountingStrategy, BordaConfig> { +public class BordaVoteCounting extends AbstractVoteCountingMinMaxChoice<BordaVoteCountingStrategy, BordaConfig> { public static final int ID = 5; 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 2b2a68ae..d336d88b 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 @@ -22,7 +22,7 @@ package org.chorem.pollen.votecounting; */ import org.chorem.pollen.votecounting.model.ChoiceToVoteRenderType; -import org.chorem.pollen.votecounting.model.MaxChoicesNumberConfig; +import org.chorem.pollen.votecounting.model.MinMaxChoicesNumberConfig; import static org.nuiton.i18n.I18n.n; @@ -32,14 +32,14 @@ import static org.nuiton.i18n.I18n.n; * @author Tony Chemit - dev@tchemit.fr * @since 1.6 */ -public class NormalVoteCounting extends AbstractVoteCountingMaxChoice<NormalVoteCountingStrategy, MaxChoicesNumberConfig> { +public class NormalVoteCounting extends AbstractVoteCountingMinMaxChoice<NormalVoteCountingStrategy, MinMaxChoicesNumberConfig> { public static final int ID = 1; public NormalVoteCounting() { super(ID, NormalVoteCountingStrategy.class, - MaxChoicesNumberConfig.class, + MinMaxChoicesNumberConfig.class, n("pollen.voteCountingType.normal"), n("pollen.voteCountingType.normal.shortHelp"), n("pollen.voteCountingType.normal.help") diff --git a/pollen-votecounting-normal/src/main/java/org/chorem/pollen/votecounting/NormalVoteCountingStrategy.java b/pollen-votecounting-normal/src/main/java/org/chorem/pollen/votecounting/NormalVoteCountingStrategy.java index 9301068c..733ea2a6 100644 --- a/pollen-votecounting-normal/src/main/java/org/chorem/pollen/votecounting/NormalVoteCountingStrategy.java +++ b/pollen-votecounting-normal/src/main/java/org/chorem/pollen/votecounting/NormalVoteCountingStrategy.java @@ -22,7 +22,7 @@ package org.chorem.pollen.votecounting; import com.google.common.collect.Sets; import org.chorem.pollen.votecounting.model.ChoiceScore; -import org.chorem.pollen.votecounting.model.MaxChoicesNumberConfig; +import org.chorem.pollen.votecounting.model.MinMaxChoicesNumberConfig; import org.chorem.pollen.votecounting.model.VoteCountingResult; import org.chorem.pollen.votecounting.model.VoteForChoice; import org.chorem.pollen.votecounting.model.Voter; @@ -39,7 +39,7 @@ import java.util.Set; * @author Tony Chemit - dev@tchemit.fr * @since 1.4.5 */ -public class NormalVoteCountingStrategy extends AbstractVoteCountingStrategy<MaxChoicesNumberConfig> { +public class NormalVoteCountingStrategy extends AbstractVoteCountingStrategy<MinMaxChoicesNumberConfig> { @Override public VoteCountingResult votecount(Set<Voter> voters) { diff --git a/pollen-votecounting-normal/src/test/java/org/chorem/pollen/votecounting/NormalVoteCountingStrategyTest.java b/pollen-votecounting-normal/src/test/java/org/chorem/pollen/votecounting/NormalVoteCountingStrategyTest.java index 1ec22829..0cb63e5d 100644 --- a/pollen-votecounting-normal/src/test/java/org/chorem/pollen/votecounting/NormalVoteCountingStrategyTest.java +++ b/pollen-votecounting-normal/src/test/java/org/chorem/pollen/votecounting/NormalVoteCountingStrategyTest.java @@ -24,7 +24,7 @@ import com.google.common.collect.Sets; import org.chorem.pollen.votecounting.model.ChoiceScore; import org.chorem.pollen.votecounting.model.ListOfVoter; import org.chorem.pollen.votecounting.model.ListVoteCountingResult; -import org.chorem.pollen.votecounting.model.MaxChoicesNumberConfig; +import org.chorem.pollen.votecounting.model.MinMaxChoicesNumberConfig; import org.chorem.pollen.votecounting.model.SimpleVoter; import org.chorem.pollen.votecounting.model.SimpleVoterBuilder; import org.chorem.pollen.votecounting.model.VoteCountingResult; @@ -66,7 +66,7 @@ public class NormalVoteCountingStrategyTest { @Before public void setUp() throws Exception { strategy = voteCounting.newStrategy(); - strategy.setConfig(new MaxChoicesNumberConfig()); + strategy.setConfig(new MinMaxChoicesNumberConfig()); } @Test 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 72d2fcdf..79e3a3db 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 @@ -22,7 +22,7 @@ package org.chorem.pollen.votecounting; */ import org.chorem.pollen.votecounting.model.ChoiceToVoteRenderType; -import org.chorem.pollen.votecounting.model.MaxChoicesNumberConfig; +import org.chorem.pollen.votecounting.model.MinMaxChoicesNumberConfig; import static org.nuiton.i18n.I18n.n; @@ -32,14 +32,14 @@ import static org.nuiton.i18n.I18n.n; * @author Tony Chemit - dev@tchemit.fr * @since 1.6 */ -public class NumberVoteCounting extends AbstractVoteCountingMaxChoice<NumberVoteCountingStrategy, MaxChoicesNumberConfig> { +public class NumberVoteCounting extends AbstractVoteCountingMinMaxChoice<NumberVoteCountingStrategy, MinMaxChoicesNumberConfig> { public static final int ID = 4; public NumberVoteCounting() { super(ID, NumberVoteCountingStrategy.class, - MaxChoicesNumberConfig.class, + MinMaxChoicesNumberConfig.class, n("pollen.voteCountingType.number"), n("pollen.voteCountingType.number.shortHelp"), n("pollen.voteCountingType.number.help") diff --git a/pollen-votecounting-number/src/main/java/org/chorem/pollen/votecounting/NumberVoteCountingStrategy.java b/pollen-votecounting-number/src/main/java/org/chorem/pollen/votecounting/NumberVoteCountingStrategy.java index 8108b0a9..5c274055 100644 --- a/pollen-votecounting-number/src/main/java/org/chorem/pollen/votecounting/NumberVoteCountingStrategy.java +++ b/pollen-votecounting-number/src/main/java/org/chorem/pollen/votecounting/NumberVoteCountingStrategy.java @@ -22,7 +22,7 @@ package org.chorem.pollen.votecounting; import com.google.common.collect.Sets; import org.chorem.pollen.votecounting.model.ChoiceScore; -import org.chorem.pollen.votecounting.model.MaxChoicesNumberConfig; +import org.chorem.pollen.votecounting.model.MinMaxChoicesNumberConfig; import org.chorem.pollen.votecounting.model.VoteCountingResult; import org.chorem.pollen.votecounting.model.VoteForChoice; import org.chorem.pollen.votecounting.model.Voter; @@ -36,7 +36,7 @@ import java.util.Set; * @author Tony Chemit - dev@tchemit.fr * @since 1.4.5 */ -public class NumberVoteCountingStrategy extends AbstractVoteCountingStrategy<MaxChoicesNumberConfig> { +public class NumberVoteCountingStrategy extends AbstractVoteCountingStrategy<MinMaxChoicesNumberConfig> { @Override public VoteCountingResult votecount(Set<Voter> voters) { diff --git a/pollen-votecounting-number/src/test/java/org/chorem/pollen/votecounting/NumberVoteCountingStrategyTest.java b/pollen-votecounting-number/src/test/java/org/chorem/pollen/votecounting/NumberVoteCountingStrategyTest.java index 9f3a2bb7..ff3901b1 100644 --- a/pollen-votecounting-number/src/test/java/org/chorem/pollen/votecounting/NumberVoteCountingStrategyTest.java +++ b/pollen-votecounting-number/src/test/java/org/chorem/pollen/votecounting/NumberVoteCountingStrategyTest.java @@ -24,7 +24,7 @@ import com.google.common.collect.Sets; import org.chorem.pollen.votecounting.model.ChoiceScore; import org.chorem.pollen.votecounting.model.ListOfVoter; import org.chorem.pollen.votecounting.model.ListVoteCountingResult; -import org.chorem.pollen.votecounting.model.MaxChoicesNumberConfig; +import org.chorem.pollen.votecounting.model.MinMaxChoicesNumberConfig; import org.chorem.pollen.votecounting.model.SimpleVoter; import org.chorem.pollen.votecounting.model.SimpleVoterBuilder; import org.chorem.pollen.votecounting.model.VoteCountingResult; @@ -67,7 +67,7 @@ public class NumberVoteCountingStrategyTest { @Before public void setUp() throws Exception { strategy = voteCounting.newStrategy(); - strategy.setConfig(new MaxChoicesNumberConfig()); + strategy.setConfig(new MinMaxChoicesNumberConfig()); } @Test -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm