branch develop updated (bd8c9750 -> 03fb89bc)
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 bd8c9750 Afficher le détail de resultat pour les systèmes de vote complex (ref #35) new 03fb89bc Afficher le détail de resultat pour les systèmes de vote complex (ref #35) 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 03fb89bc9d1369767d9d67e51913a4265445aeb6 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Wed Jun 28 15:27:09 2017 +0200 Afficher le détail de resultat pour les systèmes de vote complex (ref #35) Summary of changes: .../voteCountingType/BordaDetailResult.tag.html | 118 ++++++++++++++++++++ .../CondorcetDetailResult.tag.html | 111 +++++++++++++++++++ .../voteCountingType/CoombsDetailResult.tag.html | 123 +++++++++++++++++++++ .../InstantRunoffDetailResult.tag.html | 102 +++++++++++++++++ 4 files changed, 454 insertions(+) create mode 100644 pollen-ui-riot-js/src/main/web/tag/voteCountingType/BordaDetailResult.tag.html create mode 100644 pollen-ui-riot-js/src/main/web/tag/voteCountingType/CondorcetDetailResult.tag.html create mode 100644 pollen-ui-riot-js/src/main/web/tag/voteCountingType/CoombsDetailResult.tag.html create mode 100644 pollen-ui-riot-js/src/main/web/tag/voteCountingType/InstantRunoffDetailResult.tag.html -- 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 03fb89bc9d1369767d9d67e51913a4265445aeb6 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Wed Jun 28 15:27:09 2017 +0200 Afficher le détail de resultat pour les systèmes de vote complex (ref #35) --- .../voteCountingType/BordaDetailResult.tag.html | 118 ++++++++++++++++++++ .../CondorcetDetailResult.tag.html | 111 +++++++++++++++++++ .../voteCountingType/CoombsDetailResult.tag.html | 123 +++++++++++++++++++++ .../InstantRunoffDetailResult.tag.html | 102 +++++++++++++++++ 4 files changed, 454 insertions(+) diff --git a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/BordaDetailResult.tag.html b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/BordaDetailResult.tag.html new file mode 100644 index 00000000..1a84123e --- /dev/null +++ b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/BordaDetailResult.tag.html @@ -0,0 +1,118 @@ +require("../poll/ChoiceView.tag.html"); +<BordaDetailResult> + <h3 class="c-heading">{__.title}</h3> + <div class="ranks"> + <div class="choices"> + <div class="cell separator-right">{__.ranks}</div> + <div class="cell separator-right separator-top">{__.points}</div> + <div each={choice in poll.choices} class="cell separator-top separator-right"> + <ChoiceView choice={choice} center="true"/> + </div> + </div> + <div class="window"> + <div class="frame"> + <div class="rank separator-right" each={rank in Array.from(Array(poll.choices.length).keys())}> + <div class="cell"> + {rank + 1} + </div> + <div class="cell separator-top"> + {poll.choices.length - rank} + </div> + <div each={choice in poll.choices} class="cell separator-top"> + {getRankScore(choice, rank)} + </div> + </div> + <div class="rank score"> + <div class="cell"> </div> + <div class="cell"> + {__.total} + </div> + + <div each={choice in poll.choices} class="cell separator-top"> + {getScore(choice)} + </div> + </div> + </div> + </div> + </div> + + <script type="es6"> + let session = require("../../js/Session"); + this.installBundle(session, "poll_results_borda"); + + this.poll = require("../../js/Poll.js"); + this.onPollChange = poll => { + this.poll = poll; + this.pointsByRank = poll.choices ? (Array.from(Array(poll.choices.length).keys(), i => poll.choices.length - i)) : []; + this.update(); + }; + + this.getRankScore = (choice, rank) => { + let rankScore = this.poll.results.detail.choiceRanks.find(r => r.choiceId === choice.id && r.rank === rank); + return rankScore ? rankScore.score : 0; + }; + + this.getScore = (choice) => { + let score = this.poll.results.scores.find(s => s.choiceId === choice.id); + return score ? score.scoreValue : 0; + }; + + this.listen("poll", this.onPollChange); + + </script> + + <style> + bordadetailresult { + width: 100%; + } + + .c-heading { + text-align: center; + } + + .ranks { + display: flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: center; + align-items: stretch; + margin-top: 20px; + + } + + .choices, + .rank { + min-width: 100px; + } + + .choices { + flex-grow: 0 + } + + .cell { + text-align: center; + padding: 3px 0; + height: 1.5em + } + + .window { + overflow-x: auto; + overflow-y: hidden; + } + + .window .frame { + display: flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: flex-start; + align-items: stretch; + height: 100%; + } + + .score { + font-weight: bold; + } + + </style> + +</BordaDetailResult> diff --git a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/CondorcetDetailResult.tag.html b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/CondorcetDetailResult.tag.html new file mode 100644 index 00000000..f84f049b --- /dev/null +++ b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/CondorcetDetailResult.tag.html @@ -0,0 +1,111 @@ +require("../poll/ChoiceView.tag.html"); +<CondorcetDetailResult> + <h3 class="c-heading">{__.title}</h3> + <div class="battles"> + <div class="runners"> + <div class="cell separator-right"></div> + <div each={runner in poll.choices} class="cell separator-top separator-right"> + <ChoiceView choice={runner} center="true"/> + </div> + <div class="cell separator-top separator-right score">{__.total}</div> + </div> + <div class="window"> + <div class="frame"> + <div class="opponent separator-right" each={opponent in poll.choices}> + <div class="cell"> + <ChoiceView choice={opponent} center="true"/> + </div> + <div each={runner in poll.choices} class="cell separator-top"> + {getBattleScore(opponent, runner)} + </div> + <div class="cell separator-top score"> + {getScore(opponent)} + </div> + </div> + </div> + </div> + </div> + + <script type="es6"> + let session = require("../../js/Session"); + this.installBundle(session, "poll_results_condorcet"); + + this.poll = require("../../js/Poll.js"); + this.onPollChange = poll => { + this.poll = poll; + this.update(); + }; + + this.getBattleScore = (opponent, runner) => { + let result = ""; + if (opponent !== runner) { + let battle = this.poll.results.detail.battles.find(b => b.opponentId === opponent.id && b.runnerId === runner.id); + result = battle ? battle.score : 0; + } + return result; + }; + + this.getScore = (opponent) => { + let score = this.poll.results.scores.find(s => s.choiceId === opponent.id); + return score ? score.scoreValue : 0; + }; + + this.listen("poll", this.onPollChange); + + </script> + + <style> + condorcetdetailresult { + width: 100%; + } + + .c-heading { + text-align: center; + } + + .battles { + display: flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: center; + align-items: stretch; + margin-top: 20px; + + } + + .runners, + .opponent { + min-width: 100px; + } + + .runners { + flex-grow: 0 + } + + .cell { + text-align: center; + padding: 3px 0; + height: 1.5em + } + + .window { + overflow-x: auto; + overflow-y: hidden; + } + + .window .frame { + display: flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: flex-start; + align-items: stretch; + height: 100%; + } + + .score { + font-weight: bold; + } + + </style> + +</CondorcetDetailResult> 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 new file mode 100644 index 00000000..230e9aef --- /dev/null +++ b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/CoombsDetailResult.tag.html @@ -0,0 +1,123 @@ +require("../poll/ChoiceView.tag.html"); +<CoombsDetailResult> + <h3 class="c-heading">{__.title}</h3> + <div class="rounds"> + <div class="choices"> + <div class="cell separator-right">{__.rounds}</div> + <div class="cell separator-top separator-right">{__.ranks}</div> + <div each={choice in poll.choices} class="cell separator-top separator-right"> + <ChoiceView choice={choice} center="true"/> + </div> + </div> + <div class="window"> + <div class="frame"> + <div class="round separator-right" each={round, index in poll.results.detail.rounds}> + <div class="cell"> + {index + 1} + </div> + <div class="cell2"> + <div class="cell separator-top separator-right">{parent.__.firstRank}</div> + <div class="cell separator-top">{parent.__.lastRank}</div> + </div> + + <div each={choice in poll.choices} class="cell2 {eliminate: isExclude(choice, round)}"> + <div class="cell separator-top separator-right">{getRoundFirstScore(choice, round)}</div> + <div class="cell separator-top">{getRoundLastScore(choice, round)}</div> + </div> + </div> + </div> + </div> + </div> + + <script type="es6"> + let session = require("../../js/Session"); + this.installBundle(session, "poll_results_coombs"); + + this.poll = require("../../js/Poll.js"); + this.onPollChange = poll => { + this.poll = poll; + this.update(); + }; + + this.getRoundFirstScore = (choice, round) => { + let rankScore = round.roundChoices.find(r => r.choiceId === choice.id); + return rankScore ? rankScore.firstScore || 0 : ""; + }; + + this.getRoundLastScore = (choice, round) => { + let rankScore = round.roundChoices.find(r => r.choiceId === choice.id); + return rankScore ? rankScore.lastScore || 0 : ""; + }; + + this.isExclude = (choice, round) => { + return round.choiceIdsExclude && round.choiceIdsExclude.indexOf(choice.id) >= 0; + }; + + this.listen("poll", this.onPollChange); + + </script> + + <style> + coombsdetailresult { + width: 100%; + } + + .c-heading { + text-align: center; + } + + .rounds { + display: flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: center; + align-items: stretch; + margin-top: 20px; + + } + + .choices, + .round { + min-width: 100px; + } + + .choices { + flex-grow: 0 + } + + .cell { + text-align: center; + padding: 3px 0; + height: 1.5em + } + + .cell2 { + display: flex; + } + + .cell2>* { + flex-grow: 1; + width: 50% + } + + .window { + overflow-x: auto; + overflow-y: hidden; + } + + .window .frame { + display: flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: flex-start; + align-items: stretch; + height: 100%; + } + + .eliminate { + text-decoration: line-through; + } + + </style> + +</CoombsDetailResult> diff --git a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/InstantRunoffDetailResult.tag.html b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/InstantRunoffDetailResult.tag.html new file mode 100644 index 00000000..1be16270 --- /dev/null +++ b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/InstantRunoffDetailResult.tag.html @@ -0,0 +1,102 @@ +require("../poll/ChoiceView.tag.html"); +<InstantRunoffDetailResult> + <h3 class="c-heading">{__.title}</h3> + <div class="rounds"> + <div class="choices"> + <div class="cell separator-right">{__.rounds}</div> + <div each={choice in poll.choices} class="cell separator-top separator-right"> + <ChoiceView choice={choice} center="true"/> + </div> + </div> + <div class="window"> + <div class="frame"> + <div class="round separator-right" each={round, index in poll.results.detail.rounds}> + <div class="cell"> + {index + 1} + </div> + <div each={choice in poll.choices} class="cell separator-top {eliminate: isExclude(choice, round)}"> + {getRoundScore(choice, round)} + </div> + </div> + </div> + </div> + </div> + + <script type="es6"> + let session = require("../../js/Session"); + this.installBundle(session, "poll_results_instantRunoff"); + + this.poll = require("../../js/Poll.js"); + this.onPollChange = poll => { + this.poll = poll; + this.update(); + }; + + this.getRoundScore = (choice, round) => { + let rankScore = round.roundChoices.find(r => r.choiceId === choice.id); + return rankScore ? rankScore.score : ""; + }; + + this.isExclude = (choice, round) => { + return round.choiceIdsExclude && round.choiceIdsExclude.indexOf(choice.id) >= 0; + }; + + this.listen("poll", this.onPollChange); + + </script> + + <style> + instantrunoffdetailresult { + width: 100%; + } + + .c-heading { + text-align: center; + } + + .rounds { + display: flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: center; + align-items: stretch; + margin-top: 20px; + + } + + .choices, + .round { + min-width: 100px; + } + + .choices { + flex-grow: 0 + } + + .cell { + text-align: center; + padding: 3px 0; + height: 1.5em + } + + .window { + overflow-x: auto; + overflow-y: hidden; + } + + .window .frame { + display: flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: flex-start; + align-items: stretch; + height: 100%; + } + + .eliminate { + text-decoration: line-through; + } + + </style> + +</InstantRunoffDetailResult> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm