liquid_feedback_core
changeset 377:f65814f4d3fc
Improved log output of lf_update_suggestion_order
author | jbe |
---|---|
date | Mon Mar 18 09:24:51 2013 +0100 (2013-03-18) |
parents | 4a18576a359f |
children | e88d0606891f |
files | lf_update_suggestion_order.c |
line diff
1.1 --- a/lf_update_suggestion_order.c Mon Mar 18 09:09:29 2013 +0100 1.2 +++ b/lf_update_suggestion_order.c Mon Mar 18 09:24:51 2013 +0100 1.3 @@ -150,7 +150,7 @@ 1.4 for (i=0; i<candidate_count; i++) { 1.5 int log_candidate = 0; 1.6 if (logging && candidates[i].score < 1.0 && !candidates[i].seat) log_candidate = 1; 1.7 - if (log_candidate) printf("Score for suggestion #%s = %.4f+%.4f*%.4f=", candidates[i].key, candidates[i].score, scale, candidates[i].score_per_step); 1.8 + if (log_candidate) printf("Score for suggestion #%s = %.4f+%.4f*%.4f", candidates[i].key, candidates[i].score, scale, candidates[i].score_per_step); 1.9 if (candidates[i].score_per_step > 0.0) { 1.10 double max_scale; 1.11 max_scale = (1.0-candidates[i].score) / candidates[i].score_per_step; 1.12 @@ -163,7 +163,10 @@ 1.13 if (candidates[i].score >= 1.0) remaining--; 1.14 } 1.15 } 1.16 - if (log_candidate) printf("%.4f.\n", candidates[i].score); 1.17 + if (log_candidate) { 1.18 + if (candidates[i].score >= 1.0) printf("=1\n"); 1.19 + else printf("=%.4f\n", candidates[i].score); 1.20 + } 1.21 // when there is only one candidate remaining, then break inner (and thus outer) loop: 1.22 if (remaining <= 1) { 1.23 break; 1.24 @@ -382,18 +385,22 @@ 1.25 if (logging) { 1.26 for (i=0; i<ballot_count; i++) { 1.27 int j; 1.28 - printf("Ballot #%i: ", i+1); 1.29 for (j=0; j<4; j++) { 1.30 int k; 1.31 - if (j) printf(", "); 1.32 - printf("preference %i (", j+1); 1.33 + printf("Ballot #%i, ", i+1); 1.34 + if (j==0) printf("1st"); 1.35 + if (j==1) printf("2nd"); 1.36 + if (j==2) printf("3rd"); 1.37 + if (j==3) printf("4th"); 1.38 + printf(" preference: "); 1.39 for (k=0; k<ballots[i].sections[j].count; k++) { 1.40 - if (k) printf(","); 1.41 - printf("s#%s", ballots[i].sections[j].candidates[k]->key); 1.42 + if (!k) printf("suggestions "); 1.43 + else printf(", "); 1.44 + printf("#%s", ballots[i].sections[j].candidates[k]->key); 1.45 } 1.46 - printf(")"); 1.47 + if (!k) printf("empty"); 1.48 + printf(".\n"); 1.49 } 1.50 - printf(".\n"); 1.51 } 1.52 } 1.53 }