update ui for multiple choice
This commit is contained in:
parent
1c4186d7fd
commit
4c2d2d8244
@ -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}`);
|
||||
|
@ -34,7 +34,7 @@ export default function publishVote(pollId, pollAnswerId) {
|
||||
requesterId: requesterUserId,
|
||||
pollId,
|
||||
questionId: 0,
|
||||
answerId: pollAnswerId,
|
||||
answerIds: [pollAnswerId],
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -15,6 +15,7 @@ export default function addPoll(meetingId, requesterId, poll) {
|
||||
key: String,
|
||||
},
|
||||
],
|
||||
isMultipleChoice: Boolean
|
||||
});
|
||||
|
||||
const userSelector = {
|
||||
|
Loading…
Reference in New Issue
Block a user