Skip to content

Commit cf34d89

Browse files
committed
fix: provide default value of 0 to votes amount
1 parent a58354a commit cf34d89

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

hooks/convertPoll.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default async (context: HookContext): Promise<HookContext> => {
1919
{ $group: { _id: '$which', total: { $sum: 1 } } }
2020
]).then(groups => groups.reduce(
2121
(acc, group) => _.set(acc, group._id + '.votes', group.total),
22-
{}
22+
{ left: { votes: 0 }, right: { votes: 0 } }
2323
));
2424

2525
const userChoice = await VoteModel.findOne({ pollId: poll._id, userId: user?._id });

0 commit comments

Comments
 (0)