Skip to content

Commit 3886697

Browse files
author
Rajeev Kumar Singh
committed
Get SelectedChoice From Poll
1 parent d1d267a commit 3886697

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

polling-app-server/src/main/java/com/example/polls/controller/PollController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public PollResponse castVote(@CurrentUser UserPrincipal userPrincipal,
125125
User user = userRepository.getOne(userPrincipal.getId());
126126

127127
Choice selectedChoice = poll.getChoices().stream()
128-
.filter(choice -> choice.getId() == voteRequest.getChoiceId())
128+
.filter(choice -> choice.getId().equals(voteRequest.getChoiceId()))
129129
.findFirst()
130130
.orElseThrow(() -> new ResourceNotFoundException("Choice", "id", voteRequest.getChoiceId()));
131131

0 commit comments

Comments
 (0)