diff --git a/bigbluebutton-html5/imports/api/polls/server/handlers/userResponded.js b/bigbluebutton-html5/imports/api/polls/server/handlers/userResponded.js index 6c1b835ec0..c6061acdac 100644 --- a/bigbluebutton-html5/imports/api/polls/server/handlers/userResponded.js +++ b/bigbluebutton-html5/imports/api/polls/server/handlers/userResponded.js @@ -3,11 +3,11 @@ import Polls from '/imports/api/polls'; import Logger from '/imports/startup/server/logger'; export default function userResponded({ body }) { - const { pollId, userId, answerId } = body; + const { pollId, userId, answerIds } = body; check(pollId, String); check(userId, String); - check(answerId, Number); + check(answerIds, Array); const selector = { id: pollId, @@ -18,7 +18,7 @@ export default function userResponded({ body }) { users: userId, }, $push: { - responses: { userId, answerId }, + responses: { userId, answerId: answerIds[0] }, }, }; @@ -26,7 +26,7 @@ export default function userResponded({ body }) { const numberAffected = Polls.update(selector, modifier); if (numberAffected) { - Logger.info(`Updating Poll response (userId: ${userId}, response: ${answerId}, pollId: ${pollId})`); + Logger.info(`Updating Poll response (userId: ${userId}, response: ${answerIds[0]}, pollId: ${pollId})`); } } catch (err) { Logger.error(`Updating Poll responses: ${err}`); diff --git a/bigbluebutton-html5/imports/api/polls/server/methods/publishVote.js b/bigbluebutton-html5/imports/api/polls/server/methods/publishVote.js index 6aabfe10c6..7d31318090 100644 --- a/bigbluebutton-html5/imports/api/polls/server/methods/publishVote.js +++ b/bigbluebutton-html5/imports/api/polls/server/methods/publishVote.js @@ -34,7 +34,7 @@ export default function publishVote(pollId, pollAnswerId) { requesterId: requesterUserId, pollId, questionId: 0, - answerId: pollAnswerId, + answerIds: [pollAnswerId], }; /* diff --git a/bigbluebutton-html5/imports/api/polls/server/modifiers/addPoll.js b/bigbluebutton-html5/imports/api/polls/server/modifiers/addPoll.js index 1449c306ca..28e9f2db79 100644 --- a/bigbluebutton-html5/imports/api/polls/server/modifiers/addPoll.js +++ b/bigbluebutton-html5/imports/api/polls/server/modifiers/addPoll.js @@ -15,6 +15,7 @@ export default function addPoll(meetingId, requesterId, poll) { key: String, }, ], + isMultipleChoice: Boolean }); const userSelector = {