Author: schorlet Date: 2010-01-12 10:23:10 +0100 (Tue, 12 Jan 2010) New Revision: 2838 Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java trunk/pollen-ui/src/main/webapp/poll/VoteForPoll.tml trunk/pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/business/NumberMethod.java Log: correction du d?\195?\169pouillement par groupe Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java 2010-01-11 16:17:56 UTC (rev 2837) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java 2010-01-12 09:23:10 UTC (rev 2838) @@ -663,6 +663,10 @@ return null; } + public boolean isChoiceHidden() { + return choiceOfPoll.isHidden(); + } + /** * Retourne le choix de vote correspondant au choix de sondage courant. * Modified: trunk/pollen-ui/src/main/webapp/poll/VoteForPoll.tml =================================================================== --- trunk/pollen-ui/src/main/webapp/poll/VoteForPoll.tml 2010-01-11 16:17:56 UTC (rev 2837) +++ trunk/pollen-ui/src/main/webapp/poll/VoteForPoll.tml 2010-01-12 09:23:10 UTC (rev 2838) @@ -58,7 +58,7 @@ </t:if> <t:if test="textType"> <t:loop t:source="poll.choiceDTOs" t:value="choiceOfPoll" volatile="true"> - <t:if test="!choiceOfPoll.hidden"> + <t:if test="!isChoiceHidden()"> <th> <t:unless test="isDescNull()"> <span t:type="ck/Tooltip" title="${message:description}" value="${choiceOfPoll.description}" effect="blind"> @@ -81,7 +81,7 @@ </t:if> <t:if test="dateType"> <t:loop t:source="poll.choiceDTOs" t:value="choiceOfPoll" volatile="true"> - <t:if test="!choiceOfPoll.hidden"> + <t:if test="!isChoiceHidden()"> <t:unless test="isDescNull()"> <th class="desc"> <span t:type="ck/Tooltip" title="${message:description}" value="${choiceOfPoll.description}" effect="blind"> @@ -100,7 +100,7 @@ <t:if test="imageType"> <t:ImageContextLink t:id="imgContext" t:thumb="true" t:dir="poll.pollId"/> <t:loop t:source="poll.choiceDTOs" t:value="choiceOfPoll" volatile="true"> - <t:if test="!choiceOfPoll.hidden"> + <t:if test="!isChoiceHidden()"> <t:unless test="isDescNull()"> <th class="desc"> <span t:type="ck/Tooltip" title="${message:description}" value="${choiceOfPoll.description}" effect="blind"> @@ -180,7 +180,7 @@ </t:unless> </td> <t:loop t:source="poll.choiceDTOs" t:value="choiceOfPoll" volatile="true"> - <t:if test="!choiceOfPoll.hidden"> + <t:if test="!isChoiceHidden()"> ${setCurrentVoteChoice()} <t:if test="${poll.anonymous}"> <td class="anonymous">?</td> @@ -229,7 +229,7 @@ <t:PageLink t:page="poll/results" t:context="${poll.pollId}">${message:results}</t:PageLink> </td> <t:loop t:source="poll.choiceDTOs" t:value="choiceOfPoll" volatile="true"> - <t:if test="!choiceOfPoll.hidden"> + <t:if test="!isChoiceHidden()"> <td class="result">${currentChoiceResult}</td> </t:if> </t:loop> Modified: trunk/pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/business/NumberMethod.java =================================================================== --- trunk/pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/business/NumberMethod.java 2010-01-11 16:17:56 UTC (rev 2837) +++ trunk/pollen-votecounting/src/main/java/org/chorem/pollen/votecounting/business/NumberMethod.java 2010-01-12 09:23:10 UTC (rev 2838) @@ -10,16 +10,11 @@ * @version $Revision$ $Date$ * @since 1.2.2 */ -public class NumberMethod extends StandardMethod { +public class NumberMethod implements Method { + @Override public void executeCounting(List<Choice> choices, boolean byGroup) { - calculateGroups(choices); - if (byGroup) { - calculateChoicesByGroup(choices); - } - } - - public void calculateGroups(List<Choice> choices) { + for (Choice choice : choices) { double totalChoice = 0.; @@ -30,7 +25,11 @@ double value = vote.getValue(); if (value >= 0) { - totalGroup += vote.getValue() * vote.getWeight(); + if (byGroup) { + totalGroup += vote.getValue() * vote.getWeight() * group.getWeight(); + } else { + totalGroup += vote.getValue() * vote.getWeight(); + } } } @@ -45,8 +44,6 @@ @Override public void executeStats(List<Choice> choices, boolean groupCounting, Choice choice, ChoiceDTO choiceDTO) { - - super.executeStats(choices, groupCounting, choice, choiceDTO); int nbBlankVotes = 0; double average = 0;