diff options
author | Eugene Sokolov <eug-vs@keemail.me> | 2020-06-25 18:56:55 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-25 18:56:55 +0300 |
commit | 343a975413d8d3ce8194507017fb4ca01a4faf54 (patch) | |
tree | bdf1ebf9113739bfb08cd61239c117d02e273fe7 /hooks/convertPoll.ts | |
parent | 32e9cd6eec8f45fd9b53c8ab3af5907c8d4064bc (diff) | |
parent | 7bf3e5020bf456b1450bb19bea43df7862cfb08e (diff) | |
download | which-api-343a975413d8d3ce8194507017fb4ca01a4faf54.tar.gz |
Merge pull request #10 from which-ecosystem/circleci
Configure CI
Diffstat (limited to 'hooks/convertPoll.ts')
-rw-r--r-- | hooks/convertPoll.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/hooks/convertPoll.ts b/hooks/convertPoll.ts index 1c32851..5e6f9f4 100644 --- a/hooks/convertPoll.ts +++ b/hooks/convertPoll.ts @@ -2,7 +2,7 @@ import { HookContext } from '@feathersjs/feathers'; import { Types } from 'mongoose'; import bluebird from 'bluebird'; import _ from 'lodash'; -import { Poll, User, Vote } from 'which-types'; +import { Poll } from 'which-types'; import { PollSchema } from '../models/polls/poll.schema'; import VoteModel from '../models/votes/vote.model'; @@ -18,7 +18,7 @@ export default async (context: HookContext): Promise<HookContext> => { { $match: { pollId: Types.ObjectId(poll._id) } }, { $group: { _id: '$which', total: { $sum: 1 } } } ]).then(groups => groups.reduce( - (acc, group) => _.set(acc, group._id + '.votes', group.total), + (acc, group) => _.set(acc, `${group._id}.votes`, group.total), { left: { votes: 0 }, right: { votes: 0 } } )); |