|
@@ -40,16 +40,17 @@ public class ComputeResultController {
|
40
|
40
|
|
41
|
41
|
for (Vote v: allVotes) {
|
42
|
42
|
Long optionID = (v.getOption().getId());
|
|
43
|
+ OptionCount temp;
|
43
|
44
|
if (!optionCountsMap.keySet().contains(optionID)) {
|
44
|
|
- optionCountsMap.put(optionID, new OptionCount());
|
45
|
|
-// optionCountsMap.get(optionID).setCount(1);
|
|
45
|
+ temp = new OptionCount();
|
|
46
|
+ temp.setCount(1);
|
|
47
|
+ optionCountsMap.put(optionID,temp);
|
46
|
48
|
} else {
|
47
|
|
- OptionCount temp = optionCountsMap.get(optionID);
|
|
49
|
+ temp = optionCountsMap.get(optionID);
|
48
|
50
|
temp.setCount(temp.getCount()+1);
|
49
|
51
|
optionCountsMap.replace(optionID, temp);
|
50
|
52
|
}
|
51
|
53
|
}
|
52
|
|
-
|
53
|
54
|
voteResult.setTotalVotes((int)voteCount);
|
54
|
55
|
voteResult.setResults(optionCountsMap.values());
|
55
|
56
|
|