if (pollManager.hasVoted(roomId, rc.getUser_id())) {
log.debug("hasVoted: true");
return -1;
}
// get Poll
RoomPoll roomP = pollManager.getPoll(roomId);
log.debug("vote: " + pollvalue + " " + pollTypeId + " "
+ roomP.getPollQuestion());
log.debug("hasVoted: false");
RoomPollAnswers rpA = new RoomPollAnswers();
if (roomP.getPollType().getIsNumericAnswer()) {
log.debug("numeric");
rpA.setPointList(pollvalue);
} else {
log.debug("boolean");
// Is boolean Question
rpA.setAnswer(new Boolean(pollvalue == 1));
}
rpA.setVotedUser(userManager.getUserById(rc.getUser_id()));
rpA.setVoteDate(new Date());
rpA.setRoomPoll(roomP);
roomP.getRoomPollAnswerList().add(rpA);
pollManager.updatePoll(roomP);
return 1;
} catch (Exception err) {
log.error("[vote]", err);
}