Parcourir la source

Revert "gave up on testing, will switch over to mockito tomorrow, currently working on computeResult"

This reverts commit c4d3afb2e00efbd544e1c4a2af44b0a9352488fb.
Trinh Tong il y a 5 ans
Parent
révision
0e54029a39

+ 4
- 5
src/main/java/io/zipcoder/tc_spring_poll_application/controller/ComputeResultController.java Voir le fichier

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