diff options
-rw-r--r-- | hooks/convertPoll.ts | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/hooks/convertPoll.ts b/hooks/convertPoll.ts index 4da25c1..1c32851 100644 --- a/hooks/convertPoll.ts +++ b/hooks/convertPoll.ts @@ -22,7 +22,9 @@ export default async (context: HookContext): Promise<HookContext> => { { left: { votes: 0 }, right: { votes: 0 } } )); - const userChoice = await VoteModel.findOne({ pollId: poll._id, userId: user?._id }); + const userChoice = await VoteModel.findOne( + { pollId: poll._id, userId: user?._id } + ).then(vote => vote?.which); return _.merge( _.omit(poll, ['authorId']), |