{"action":"created","comment":{"url":"https://api.github.com/repos/bodhiproject/bodhi-server/pulls/comments/228993595","pull_request_review_id":169382113,"id":228993595,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyODk5MzU5NQ==","diff_hunk":"@@ -496,6 +495,32 @@ module.exports = {\n     return winnings;\n   },\n \n+  leaderboardStats: async (root, { filter, orderBy, limit, skip }, { db: { Votes, Topics } }) => {\n+      const result = await Votes.find({});\n+      let participantsCount = 0;\n+      let totalQTUM = new BigNumber(0);\n+      let totalBOT = new BigNumber(0);\n+      result.reduce((acc, cur) => {\n+        const curAmount = new BigNumber(cur.amount);\n+        if (!acc.hasOwnProperty(cur.voterAddress)) {\n+          acc[cur.voterAddress] = '';\n+          participantsCount++;\n+        }\n+        if (cur.token === TOKEN.BOT) {\n+          totalBOT = new BigNumber(totalBOT).plus(curAmount).toString(10);","path":"src/graphql/queries.js","position":38,"original_position":38,"commit_id":"38c1cec0d512eef565a153517ef3e5c139a0c199","original_commit_id":"38c1cec0d512eef565a153517ef3e5c139a0c199","user":{"login":"dwalintukan","id":4350404,"node_id":"MDQ6VXNlcjQzNTA0MDQ=","avatar_url":"https://avatars2.githubusercontent.com/u/4350404?v=4","gravatar_id":"","url":"https://api.github.com/users/dwalintukan","html_url":"https://github.com/dwalintukan","followers_url":"https://api.github.com/users/dwalintukan/followers","following_url":"https://api.github.com/users/dwalintukan/following{/other_user}","gists_url":"https://api.github.com/users/dwalintukan/gists{/gist_id}","starred_url":"https://api.github.com/users/dwalintukan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwalintukan/subscriptions","organizations_url":"https://api.github.com/users/dwalintukan/orgs","repos_url":"https://api.github.com/users/dwalintukan/repos","events_url":"https://api.github.com/users/dwalintukan/events{/privacy}","received_events_url":"https://api.github.com/users/dwalintukan/received_events","type":"User","site_admin":false},"body":"keep it as a BigNumber type the whole time so you dont have to convert toString on every iteration. then on the return you can `totalQTUM.toString(10)` and `totalBOT.toString(10)`.","created_at":"2018-10-29T16:09:52Z","updated_at":"2018-10-29T16:11:39Z","html_url":"https://github.com/bodhiproject/bodhi-server/pull/149#discussion_r228993595","pull_request_url":"https://api.github.com/repos/bodhiproject/bodhi-server/pulls/149","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/bodhiproject/bodhi-server/pulls/comments/228993595"},"html":{"href":"https://github.com/bodhiproject/bodhi-server/pull/149#discussion_r228993595"},"pull_request":{"href":"https://api.github.com/repos/bodhiproject/bodhi-server/pulls/149"}}},"pull_request":{"url":"https://api.github.com/repos/bodhiproject/bodhi-server/pulls/149","id":226249185,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI2MjQ5MTg1","html_url":"https://github.com/bodhiproject/bodhi-server/pull/149","diff_url":"https://github.com/bodhiproject/bodhi-server/pull/149.diff","patch_url":"https://github.com/bodhiproject/bodhi-server/pull/149.patch","issue_url":"https://api.github.com/repos/bodhiproject/bodhi-server/issues/149","number":149,"state":"open","locked":false,"title":"support leaderboard stats","user":{"login":"henryzbw","id":10339131,"node_id":"MDQ6VXNlcjEwMzM5MTMx","avatar_url":"https://avatars0.githubusercontent.com/u/10339131?v=4","gravatar_id":"","url":"https://api.github.com/users/henryzbw","html_url":"https://github.com/henryzbw","followers_url":"https://api.github.com/users/henryzbw/followers","following_url":"https://api.github.com/users/henryzbw/following{/other_user}","gists_url":"https://api.github.com/users/henryzbw/gists{/gist_id}","starred_url":"https://api.github.com/users/henryzbw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henryzbw/subscriptions","organizations_url":"https://api.github.com/users/henryzbw/orgs","repos_url":"https://api.github.com/users/henryzbw/repos","events_url":"https://api.github.com/users/henryzbw/events{/privacy}","received_events_url":"https://api.github.com/users/henryzbw/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-10-26T23:19:02Z","updated_at":"2018-10-29T16:11:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d201a5e3394635927117e5f617b4bc2928a958da","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/bodhiproject/bodhi-server/pulls/149/commits","review_comments_url":"https://api.github.com/repos/bodhiproject/bodhi-server/pulls/149/comments","review_comment_url":"https://api.github.com/repos/bodhiproject/bodhi-server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bodhiproject/bodhi-server/issues/149/comments","statuses_url":"https://api.github.com/repos/bodhiproject/bodhi-server/statuses/38c1cec0d512eef565a153517ef3e5c139a0c199","head":{"label":"bodhiproject:globalLeaderboard","ref":"globalLeaderboard","sha":"38c1cec0d512eef565a153517ef3e5c139a0c199","user":{"login":"bodhiproject","id":29763948,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI5NzYzOTQ4","avatar_url":"https://avatars2.githubusercontent.com/u/29763948?v=4","gravatar_id":"","url":"https://api.github.com/users/bodhiproject","html_url":"https://github.com/bodhiproject","followers_url":"https://api.github.com/users/bodhiproject/followers","following_url":"https://api.github.com/users/bodhiproject/following{/other_user}","gists_url":"https://api.github.com/users/bodhiproject/gists{/gist_id}","starred_url":"https://api.github.com/users/bodhiproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bodhiproject/subscriptions","organizations_url":"https://api.github.com/users/bodhiproject/orgs","repos_url":"https://api.github.com/users/bodhiproject/repos","events_url":"https://api.github.com/users/bodhiproject/events{/privacy}","received_events_url":"https://api.github.com/users/bodhiproject/received_events","type":"Organization","site_admin":false},"repo":{"id":135283806,"node_id":"MDEwOlJlcG9zaXRvcnkxMzUyODM4MDY=","name":"bodhi-server","full_name":"bodhiproject/bodhi-server","private":false,"owner":{"login":"bodhiproject","id":29763948,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI5NzYzOTQ4","avatar_url":"https://avatars2.githubusercontent.com/u/29763948?v=4","gravatar_id":"","url":"https://api.github.com/users/bodhiproject","html_url":"https://github.com/bodhiproject","followers_url":"https://api.github.com/users/bodhiproject/followers","following_url":"https://api.github.com/users/bodhiproject/following{/other_user}","gists_url":"https://api.github.com/users/bodhiproject/gists{/gist_id}","starred_url":"https://api.github.com/users/bodhiproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bodhiproject/subscriptions","organizations_url":"https://api.github.com/users/bodhiproject/orgs","repos_url":"https://api.github.com/users/bodhiproject/repos","events_url":"https://api.github.com/users/bodhiproject/events{/privacy}","received_events_url":"https://api.github.com/users/bodhiproject/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/bodhiproject/bodhi-server","description":"Headless server that parses, stores, sends, and receives Bodhi-related data.","fork":false,"url":"https://api.github.com/repos/bodhiproject/bodhi-server","forks_url":"https://api.github.com/repos/bodhiproject/bodhi-server/forks","keys_url":"https://api.github.com/repos/bodhiproject/bodhi-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bodhiproject/bodhi-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bodhiproject/bodhi-server/teams","hooks_url":"https://api.github.com/repos/bodhiproject/bodhi-server/hooks","issue_events_url":"https://api.github.com/repos/bodhiproject/bodhi-server/issues/events{/number}","events_url":"https://api.github.com/repos/bodhiproject/bodhi-server/events","assignees_url":"https://api.github.com/repos/bodhiproject/bodhi-server/assignees{/user}","branches_url":"https://api.github.com/repos/bodhiproject/bodhi-server/branches{/branch}","tags_url":"https://api.github.com/repos/bodhiproject/bodhi-server/tags","blobs_url":"https://api.github.com/repos/bodhiproject/bodhi-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bodhiproject/bodhi-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bodhiproject/bodhi-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/bodhiproject/bodhi-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bodhiproject/bodhi-server/statuses/{sha}","languages_url":"https://api.github.com/repos/bodhiproject/bodhi-server/languages","stargazers_url":"https://api.github.com/repos/bodhiproject/bodhi-server/stargazers","contributors_url":"https://api.github.com/repos/bodhiproject/bodhi-server/contributors","subscribers_url":"https://api.github.com/repos/bodhiproject/bodhi-server/subscribers","subscription_url":"https://api.github.com/repos/bodhiproject/bodhi-server/subscription","commits_url":"https://api.github.com/repos/bodhiproject/bodhi-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/bodhiproject/bodhi-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/bodhiproject/bodhi-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/bodhiproject/bodhi-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/bodhiproject/bodhi-server/contents/{+path}","compare_url":"https://api.github.com/repos/bodhiproject/bodhi-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bodhiproject/bodhi-server/merges","archive_url":"https://api.github.com/repos/bodhiproject/bodhi-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bodhiproject/bodhi-server/downloads","issues_url":"https://api.github.com/repos/bodhiproject/bodhi-server/issues{/number}","pulls_url":"https://api.github.com/repos/bodhiproject/bodhi-server/pulls{/number}","milestones_url":"https://api.github.com/repos/bodhiproject/bodhi-server/milestones{/number}","notifications_url":"https://api.github.com/repos/bodhiproject/bodhi-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bodhiproject/bodhi-server/labels{/name}","releases_url":"https://api.github.com/repos/bodhiproject/bodhi-server/releases{/id}","deployments_url":"https://api.github.com/repos/bodhiproject/bodhi-server/deployments","created_at":"2018-05-29T11:06:55Z","updated_at":"2018-10-26T19:21:35Z","pushed_at":"2018-10-26T23:19:03Z","git_url":"git://github.com/bodhiproject/bodhi-server.git","ssh_url":"git@github.com:bodhiproject/bodhi-server.git","clone_url":"https://github.com/bodhiproject/bodhi-server.git","svn_url":"https://github.com/bodhiproject/bodhi-server","homepage":"https://www.bodhi.network/","size":245470,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":13,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":4,"open_issues":13,"watchers":2,"default_branch":"master"}},"base":{"label":"bodhiproject:master","ref":"master","sha":"ee61fd08c964a377503823222bdbb7c2191aef50","user":{"login":"bodhiproject","id":29763948,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI5NzYzOTQ4","avatar_url":"https://avatars2.githubusercontent.com/u/29763948?v=4","gravatar_id":"","url":"https://api.github.com/users/bodhiproject","html_url":"https://github.com/bodhiproject","followers_url":"https://api.github.com/users/bodhiproject/followers","following_url":"https://api.github.com/users/bodhiproject/following{/other_user}","gists_url":"https://api.github.com/users/bodhiproject/gists{/gist_id}","starred_url":"https://api.github.com/users/bodhiproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bodhiproject/subscriptions","organizations_url":"https://api.github.com/users/bodhiproject/orgs","repos_url":"https://api.github.com/users/bodhiproject/repos","events_url":"https://api.github.com/users/bodhiproject/events{/privacy}","received_events_url":"https://api.github.com/users/bodhiproject/received_events","type":"Organization","site_admin":false},"repo":{"id":135283806,"node_id":"MDEwOlJlcG9zaXRvcnkxMzUyODM4MDY=","name":"bodhi-server","full_name":"bodhiproject/bodhi-server","private":false,"owner":{"login":"bodhiproject","id":29763948,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI5NzYzOTQ4","avatar_url":"https://avatars2.githubusercontent.com/u/29763948?v=4","gravatar_id":"","url":"https://api.github.com/users/bodhiproject","html_url":"https://github.com/bodhiproject","followers_url":"https://api.github.com/users/bodhiproject/followers","following_url":"https://api.github.com/users/bodhiproject/following{/other_user}","gists_url":"https://api.github.com/users/bodhiproject/gists{/gist_id}","starred_url":"https://api.github.com/users/bodhiproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bodhiproject/subscriptions","organizations_url":"https://api.github.com/users/bodhiproject/orgs","repos_url":"https://api.github.com/users/bodhiproject/repos","events_url":"https://api.github.com/users/bodhiproject/events{/privacy}","received_events_url":"https://api.github.com/users/bodhiproject/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/bodhiproject/bodhi-server","description":"Headless server that parses, stores, sends, and receives Bodhi-related data.","fork":false,"url":"https://api.github.com/repos/bodhiproject/bodhi-server","forks_url":"https://api.github.com/repos/bodhiproject/bodhi-server/forks","keys_url":"https://api.github.com/repos/bodhiproject/bodhi-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bodhiproject/bodhi-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bodhiproject/bodhi-server/teams","hooks_url":"https://api.github.com/repos/bodhiproject/bodhi-server/hooks","issue_events_url":"https://api.github.com/repos/bodhiproject/bodhi-server/issues/events{/number}","events_url":"https://api.github.com/repos/bodhiproject/bodhi-server/events","assignees_url":"https://api.github.com/repos/bodhiproject/bodhi-server/assignees{/user}","branches_url":"https://api.github.com/repos/bodhiproject/bodhi-server/branches{/branch}","tags_url":"https://api.github.com/repos/bodhiproject/bodhi-server/tags","blobs_url":"https://api.github.com/repos/bodhiproject/bodhi-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bodhiproject/bodhi-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bodhiproject/bodhi-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/bodhiproject/bodhi-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bodhiproject/bodhi-server/statuses/{sha}","languages_url":"https://api.github.com/repos/bodhiproject/bodhi-server/languages","stargazers_url":"https://api.github.com/repos/bodhiproject/bodhi-server/stargazers","contributors_url":"https://api.github.com/repos/bodhiproject/bodhi-server/contributors","subscribers_url":"https://api.github.com/repos/bodhiproject/bodhi-server/subscribers","subscription_url":"https://api.github.com/repos/bodhiproject/bodhi-server/subscription","commits_url":"https://api.github.com/repos/bodhiproject/bodhi-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/bodhiproject/bodhi-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/bodhiproject/bodhi-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/bodhiproject/bodhi-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/bodhiproject/bodhi-server/contents/{+path}","compare_url":"https://api.github.com/repos/bodhiproject/bodhi-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bodhiproject/bodhi-server/merges","archive_url":"https://api.github.com/repos/bodhiproject/bodhi-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bodhiproject/bodhi-server/downloads","issues_url":"https://api.github.com/repos/bodhiproject/bodhi-server/issues{/number}","pulls_url":"https://api.github.com/repos/bodhiproject/bodhi-server/pulls{/number}","milestones_url":"https://api.github.com/repos/bodhiproject/bodhi-server/milestones{/number}","notifications_url":"https://api.github.com/repos/bodhiproject/bodhi-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bodhiproject/bodhi-server/labels{/name}","releases_url":"https://api.github.com/repos/bodhiproject/bodhi-server/releases{/id}","deployments_url":"https://api.github.com/repos/bodhiproject/bodhi-server/deployments","created_at":"2018-05-29T11:06:55Z","updated_at":"2018-10-26T19:21:35Z","pushed_at":"2018-10-26T23:19:03Z","git_url":"git://github.com/bodhiproject/bodhi-server.git","ssh_url":"git@github.com:bodhiproject/bodhi-server.git","clone_url":"https://github.com/bodhiproject/bodhi-server.git","svn_url":"https://github.com/bodhiproject/bodhi-server","homepage":"https://www.bodhi.network/","size":245470,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":13,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":4,"open_issues":13,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bodhiproject/bodhi-server/pulls/149"},"html":{"href":"https://github.com/bodhiproject/bodhi-server/pull/149"},"issue":{"href":"https://api.github.com/repos/bodhiproject/bodhi-server/issues/149"},"comments":{"href":"https://api.github.com/repos/bodhiproject/bodhi-server/issues/149/comments"},"review_comments":{"href":"https://api.github.com/repos/bodhiproject/bodhi-server/pulls/149/comments"},"review_comment":{"href":"https://api.github.com/repos/bodhiproject/bodhi-server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bodhiproject/bodhi-server/pulls/149/commits"},"statuses":{"href":"https://api.github.com/repos/bodhiproject/bodhi-server/statuses/38c1cec0d512eef565a153517ef3e5c139a0c199"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"dwalintukan"}}