Subversion Repositories eFlore/Applications.del

Compare Revisions

Ignore whitespace Rev 1765 → Rev 1766

/branches/v1.3-beryllium/src/org/tela_botanica/del/client/services/CalculVoteDeterminationService.java
46,33 → 46,34
}
private static MoyenneVote calculerProportionVote(PropositionDetermination propositionDetermination, int nbVotants) {
Map<String,VoteDetermination> votes = propositionDetermination.getVotesDeterminations();
double scoreVoteIdentifie = 0;
double scoreVoteAnonyme = 0;
Map<String,VoteDetermination> votes = propositionDetermination.getVotesDeterminations();
double scoreVote = 0;
if(votes.size() > 0) {
if (votes.size() > 0 && nbVotants > 0) {
Set<String> cles = votes.keySet();
 
for (String cle : cles) {
String idAuteur = cle;
int valeurVote = votes.get(cle).getVote();
if(estUnAuteurIdentifie(idAuteur)) {
boolean voteEstPositif = votes.get(cle).getVote() == 1 ? true : false;
 
if (estUnAuteurIdentifie(idAuteur)) {
// un votant identifiant compte comme deux votants supplémentaires
// il a donc un vote 3 fois supérieur
scoreVoteIdentifie += valeurVote;
//nbVotants += 2;
if (voteEstPositif) {
//scoreVote += 3;
scoreVote += 1;
} /*else {
scoreVote -= 3;
}*/
} else {
scoreVoteAnonyme += valeurVote;
if (voteEstPositif) {
scoreVote += 1;
} /*else {
scoreVote -= 1;
}*/
}
}
scoreVote = ((scoreVoteAnonyme + scoreVoteIdentifie)/(nbVotants))*100;
} else {
scoreVote = -1;
scoreVote = (scoreVote / nbVotants) * 100;
}
return new MoyenneVote((new Double(scoreVote)).intValue(), propositionDetermination);