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 5733f5e457ef90dcfe7c413aaa772f46649af115 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Wed Aug 2 11:51:46 2017 +0200 correction petit erreur UI et méthode de Coombs --- pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html | 12 ++++++------ .../web/tag/voteCountingType/CoombsDetailResult.tag.html | 2 +- .../pollen/votecounting/CoombsVoteCountingStrategy.java | 7 ++++--- .../votecounting/InstantRunoffVoteCountingStrategy.java | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) 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 ab9be387..68625f60 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 @@ -39,8 +39,8 @@ require("../components/HumanInput.tag.html"); <input if={!pollTypeCheckbox} class="text c-field {c-field--error: !voteInEdition && error && (error['vote.voteValue#' + choice.id] || error['vote.totalVoteValue'])}" type="number" - min="{poll.voteCountingTypeValue.minimumValue}" - max="{poll.voteCountingTypeValue.maximumValue}" + min="{poll.voteCountingTypeValue && poll.voteCountingTypeValue.minimumValue}" + max="{poll.voteCountingTypeValue && poll.voteCountingTypeValue.maximumValue}" onchange="{onVoteChanged}" ref="{choice.id}_voteValue"> </div> @@ -202,7 +202,7 @@ require("../components/HumanInput.tag.html"); this.onPollChange = poll => { this.loaded = poll.choices !== undefined; this.poll = poll; - this.pollTypeCheckbox = poll.voteCountingTypeValue && poll.voteCountingTypeValue.renderType === 'checkbox'; + this.pollTypeCheckbox = poll.voteCountingTypeValue && poll.voteCountingTypeValue.renderType === "checkbox"; this.choiceToAdd = this.poll.initChoice(this.choiceToAdd); this.onVoteChanged(); this.update(); @@ -232,7 +232,7 @@ require("../components/HumanInput.tag.html"); if (this.poll.voteCountingTypeValue.renderType === "text") { input.value = choice.voteValue; } - input.checked = choice.voteValue == 1; + input.checked = choice.voteValue === 1; } }); this.refs.voterName.focus(); @@ -375,7 +375,7 @@ require("../components/HumanInput.tag.html"); }); }; - document.body.onresize = (e) => { + document.body.onresize = () => { this.updateShowChoiceContainer(); this.update(); }; @@ -405,7 +405,7 @@ require("../components/HumanInput.tag.html"); show: false }; this.update(); - } + }; </script> <style> diff --git a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/CoombsDetailResult.tag.html b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/CoombsDetailResult.tag.html index 230e9aef..47712009 100644 --- a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/CoombsDetailResult.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/CoombsDetailResult.tag.html @@ -11,7 +11,7 @@ require("../poll/ChoiceView.tag.html"); </div> <div class="window"> <div class="frame"> - <div class="round separator-right" each={round, index in poll.results.detail.rounds}> + <div class="round separator-right" each={round, index in ((poll.results && poll.results.detail && poll.results.detail.rounds) || [])}> <div class="cell"> {index + 1} </div> diff --git a/pollen-votecounting-coombs/src/main/java/org/chorem/pollen/votecounting/CoombsVoteCountingStrategy.java b/pollen-votecounting-coombs/src/main/java/org/chorem/pollen/votecounting/CoombsVoteCountingStrategy.java index d7f16078..b66026ae 100644 --- a/pollen-votecounting-coombs/src/main/java/org/chorem/pollen/votecounting/CoombsVoteCountingStrategy.java +++ b/pollen-votecounting-coombs/src/main/java/org/chorem/pollen/votecounting/CoombsVoteCountingStrategy.java @@ -116,7 +116,7 @@ public class CoombsVoteCountingStrategy extends AbstractVoteCountingStrategy { BigDecimal scoreValue = results.get(results.size() - 1).getScoreValue(); double max = scoreValue == null ? 0 : scoreValue.doubleValue(); - if (max < totalWeight) { + if (max <= totalWeight) { // pas de majorité absolue, il faut éliminer le(s) choix les plus mauvais @@ -166,6 +166,7 @@ public class CoombsVoteCountingStrategy extends AbstractVoteCountingStrategy { // on remet à zero les scores pour les ids a conserver for (String id : idsToInclude) { resultByChoice.get(id).setScoreValue(null); + getRoundChoice(round, id); } // on calcule les scores à partir des classements @@ -195,7 +196,7 @@ public class CoombsVoteCountingStrategy extends AbstractVoteCountingStrategy { results.add(resultByChoice.get(id)); } - results.sort(Comparator.comparing(ChoiceScore::getScoreValue)); + results.sort(Comparator.comparing(ChoiceScore::getScoreValue, Comparator.nullsLast(Comparator.naturalOrder()))); // on supprime tout score à 0 Iterator<ChoiceScore> itr = results.iterator(); @@ -244,7 +245,7 @@ public class CoombsVoteCountingStrategy extends AbstractVoteCountingStrategy { List<ChoiceScore> scores = Lists.newArrayList(badScores.values()); // que l'on trie - scores.sort(Comparator.comparing(ChoiceScore::getScoreValue).reversed()); + scores.sort(Comparator.comparing(ChoiceScore::getScoreValue, Comparator.nullsLast(Comparator.naturalOrder())).reversed()); BigDecimal firstScoreValue = scores.get(0).getScoreValue(); double maxScore = firstScoreValue == null ? 0 : firstScoreValue.doubleValue(); diff --git a/pollen-votecounting-instant-runoff/src/main/java/org/chorem/pollen/votecounting/InstantRunoffVoteCountingStrategy.java b/pollen-votecounting-instant-runoff/src/main/java/org/chorem/pollen/votecounting/InstantRunoffVoteCountingStrategy.java index 70e7000a..60c23520 100644 --- a/pollen-votecounting-instant-runoff/src/main/java/org/chorem/pollen/votecounting/InstantRunoffVoteCountingStrategy.java +++ b/pollen-votecounting-instant-runoff/src/main/java/org/chorem/pollen/votecounting/InstantRunoffVoteCountingStrategy.java @@ -194,7 +194,7 @@ public class InstantRunoffVoteCountingStrategy extends AbstractVoteCountingStrat results.add(resultByChoice.get(id)); } - results.sort(Comparator.comparing(ChoiceScore::getScoreValue)); + results.sort(Comparator.comparing(ChoiceScore::getScoreValue, Comparator.nullsLast(Comparator.naturalOrder()))); // on supprime tout score à 0 Iterator<ChoiceScore> itr = results.iterator(); -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.