|
|
@@ -15,8 +15,12 @@ import java.util.Map;
|
|
15
|
15
|
|
|
16
|
16
|
@RestController
|
|
17
|
17
|
public class ComputeResultController {
|
|
|
18
|
+ private final VoteRepository voteRepository;
|
|
|
19
|
+
|
|
18
|
20
|
@Inject
|
|
19
|
|
- private VoteRepository voteRepository;
|
|
|
21
|
+ public ComputeResultController(VoteRepository voteRepository) {
|
|
|
22
|
+ this.voteRepository = voteRepository;
|
|
|
23
|
+ }
|
|
20
|
24
|
|
|
21
|
25
|
@RequestMapping(value = "/computeresult", method = RequestMethod.GET)
|
|
22
|
26
|
public ResponseEntity<?> computeResult(@RequestParam Long pollId) {
|
|
|
@@ -39,7 +43,6 @@ public class ComputeResultController {
|
|
39
|
43
|
|
|
40
|
44
|
voteResult.setTotalVotes(totalVotes);
|
|
41
|
45
|
voteResult.setResults(tempMap.values());
|
|
42
|
|
- //TODO: Implement algorithm to count votes
|
|
43
|
46
|
return new ResponseEntity<VoteResult>(voteResult, HttpStatus.OK);
|
|
44
|
47
|
}
|
|
45
|
48
|
}
|