Subversion Repositories eFlore/Applications.del

Rev

Rev 1739 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1739 Rev 1766
Line 44... Line 44...
44
	public static MoyenneVote calculerMoyenneVoteDetermination(PropositionDetermination propositionDetermination, int nbVotants) {	
44
	public static MoyenneVote calculerMoyenneVoteDetermination(PropositionDetermination propositionDetermination, int nbVotants) {	
45
		return calculerProportionVote(propositionDetermination, nbVotants);
45
		return calculerProportionVote(propositionDetermination, nbVotants);
46
	}
46
	}
Line 47... Line 47...
47
	
47
	
48
	private static MoyenneVote calculerProportionVote(PropositionDetermination propositionDetermination, int nbVotants) {
48
	private static MoyenneVote calculerProportionVote(PropositionDetermination propositionDetermination, int nbVotants) {
49
		Map<String,VoteDetermination> votes = propositionDetermination.getVotesDeterminations();
-
 
50
		
-
 
51
		double scoreVoteIdentifie = 0;
-
 
52
		double scoreVoteAnonyme = 0;
-
 
53
		
49
		Map<String,VoteDetermination> votes = propositionDetermination.getVotesDeterminations();	
Line 54... Line -...
54
		double scoreVote = 0;
-
 
55
		
50
		double scoreVote = 0;
56
		
51
		
Line 57... Line 52...
57
		if(votes.size() > 0) {
52
		if (votes.size() > 0 && nbVotants > 0) {
58
			Set<String> cles = votes.keySet();
53
			Set<String> cles = votes.keySet();
59
 
54
 
-
 
55
			for (String cle : cles) {
60
			for (String cle : cles) {
56
				String  idAuteur = cle;
61
				String  idAuteur = cle;
57
				boolean voteEstPositif = votes.get(cle).getVote() == 1 ? true : false;
62
				int valeurVote = votes.get(cle).getVote();
58
 
-
 
59
				if (estUnAuteurIdentifie(idAuteur)) {
63
				if(estUnAuteurIdentifie(idAuteur)) {
60
					// un votant identifiant compte comme deux votants supplémentaires
64
					// un votant identifiant compte comme deux votants supplémentaires
61
					// il a donc un vote 3 fois supérieur
-
 
62
					if (voteEstPositif) {
-
 
63
						//scoreVote += 3;
-
 
64
						scoreVote += 1;
65
					// il a donc un vote 3 fois supérieur
65
					} /*else {
-
 
66
						scoreVote -= 3;
66
					scoreVoteIdentifie += valeurVote;
67
					}*/
-
 
68
				} else {
-
 
69
					if (voteEstPositif) {
-
 
70
						scoreVote += 1;
67
					//nbVotants += 2;
71
					} /*else {
68
				} else {
72
						scoreVote -= 1;
69
					scoreVoteAnonyme += valeurVote;
-
 
70
				}
73
					}*/
71
			}
-
 
72
			
-
 
73
			scoreVote = ((scoreVoteAnonyme + scoreVoteIdentifie)/(nbVotants))*100;
74
				}
Line 74... Line 75...
74
		} else {
75
			}
75
			scoreVote = -1;
76
			scoreVote = (scoreVote / nbVotants) * 100;