{"action":"created","comment":{"url":"https://api.github.com/repos/mboom/TI2806/pulls/comments/64365216","id":64365216,"diff_hunk":"@@ -0,0 +1,74 @@\n+/*exported DataAggregator*/\n+/*globals OctopeerService, GithubService, BitBucketService, RSVP, console*/\n+function DataAggregator() {\n+    \"use strict\";\n+    var opService, ghService, bbService;\n+    \n+    opService = new OctopeerService();\n+    ghService = new GithubService();\n+    bbService = new BitBucketService();\n+    \n+    function setSemanticEvents(sessions) {\n+        var promises;\n+            \n+        promises = [];\n+        sessions.forEach(function (session) {\n+            promises.push(new RSVP.Promise(function (fulfill) {\n+                opService.getSemanticEventsBySession(session.id).then(function (semanticEvents) {\n+                    session.events = semanticEvents.results;\n+                    fulfill(session);\n+                });\n+            }));\n+        });\n+            \n+        return RSVP.all(promises);\n+    }\n+    \n+    function filterSessionsForComments(sessions) {\n+        sessions.forEach(function (session) {\n+            session.events = session.events.filter(function (event) {\n+                return event.event_type === \"http://146.185.128.124/api/event-types/4/\"; //Should be checked\n+            });\n+        });\n+\n+        return sessions;\n+    }\n+    \n+    function pullRequestCommentObject(sessions) {\n+        var i, pullRequests = [], pr;\n+        \n+        sessions.forEach(function (session) {\n+            var found = false;\n+            for (i = 0; i < pullRequests.length; i += 1) {\n+                pr = pullRequests[i];\n+                if (pr.repository.url === session.pull_request.repository.url &&\n+                        pr.pull_request_number === session.pull_request.pull_request_number) {\n+                    pullRequests[i].commentCount += session.events.length;\n+                    found = true;\n+                }\n+            }\n+            if (!found) {\n+                session.pull_request.commentCount = session.events.length;\n+                pullRequests.push(session.pull_request);\n+            }\n+        });\n+        return pullRequests;\n+    }\n+    \n+    this.graphCommentAmountPerPullRequests = function (userName) {\n+        var promise;\n+        console.log(userName);\n+        promise = new RSVP.Promise(function (fulfill) {\n+            opService.getSessions()\n+            //opService.getSessionsFromUser(userName)\n+                .then(setSemanticEvents)\n+                .then(filterSessionsForComments)\n+                .then(pullRequestCommentObject)\n+                .then(function (pullRequests) {\n+                    fulfill(pullRequests);","path":"src/services/DataAggregator.js","position":68,"original_position":68,"commit_id":"c4e87f7f91b128842f0509d06996e7ba532f504a","original_commit_id":"c4e87f7f91b128842f0509d06996e7ba532f504a","user":{"login":"DaanvanderValk","id":1903032,"avatar_url":"https://avatars.githubusercontent.com/u/1903032?v=3","gravatar_id":"","url":"https://api.github.com/users/DaanvanderValk","html_url":"https://github.com/DaanvanderValk","followers_url":"https://api.github.com/users/DaanvanderValk/followers","following_url":"https://api.github.com/users/DaanvanderValk/following{/other_user}","gists_url":"https://api.github.com/users/DaanvanderValk/gists{/gist_id}","starred_url":"https://api.github.com/users/DaanvanderValk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DaanvanderValk/subscriptions","organizations_url":"https://api.github.com/users/DaanvanderValk/orgs","repos_url":"https://api.github.com/users/DaanvanderValk/repos","events_url":"https://api.github.com/users/DaanvanderValk/events{/privacy}","received_events_url":"https://api.github.com/users/DaanvanderValk/received_events","type":"User","site_admin":false},"body":"What exactly does this do?","created_at":"2016-05-24T10:19:08Z","updated_at":"2016-05-24T10:19:08Z","html_url":"https://github.com/mboom/TI2806/pull/124#discussion_r64365216","pull_request_url":"https://api.github.com/repos/mboom/TI2806/pulls/124","_links":{"self":{"href":"https://api.github.com/repos/mboom/TI2806/pulls/comments/64365216"},"html":{"href":"https://github.com/mboom/TI2806/pull/124#discussion_r64365216"},"pull_request":{"href":"https://api.github.com/repos/mboom/TI2806/pulls/124"}}},"pull_request":{"url":"https://api.github.com/repos/mboom/TI2806/pulls/124","id":71188864,"html_url":"https://github.com/mboom/TI2806/pull/124","diff_url":"https://github.com/mboom/TI2806/pull/124.diff","patch_url":"https://github.com/mboom/TI2806/pull/124.patch","issue_url":"https://api.github.com/repos/mboom/TI2806/issues/124","number":124,"state":"open","locked":false,"title":"Added the DataAggregator class","user":{"login":"borek2","id":2778466,"avatar_url":"https://avatars.githubusercontent.com/u/2778466?v=3","gravatar_id":"","url":"https://api.github.com/users/borek2","html_url":"https://github.com/borek2","followers_url":"https://api.github.com/users/borek2/followers","following_url":"https://api.github.com/users/borek2/following{/other_user}","gists_url":"https://api.github.com/users/borek2/gists{/gist_id}","starred_url":"https://api.github.com/users/borek2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/borek2/subscriptions","organizations_url":"https://api.github.com/users/borek2/orgs","repos_url":"https://api.github.com/users/borek2/repos","events_url":"https://api.github.com/users/borek2/events{/privacy}","received_events_url":"https://api.github.com/users/borek2/received_events","type":"User","site_admin":false},"body":"Added the aggregator class, the purpose of this class is to send out all the requests to the services and then form the requested data into a format which is easily used by the front end.\r\n\r\nI have also added some services in the OctopeerService class. The data that is returned is not correct still, because of the endpoints that need to be implemented yet.\r\n\r\nIn the aggregator i fetched data for the first graph.\r\n\r\n@agudek ","created_at":"2016-05-24T09:44:03Z","updated_at":"2016-05-24T10:19:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"839962253da06f02acf9f6688120688f2368cd27","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mboom/TI2806/pulls/124/commits","review_comments_url":"https://api.github.com/repos/mboom/TI2806/pulls/124/comments","review_comment_url":"https://api.github.com/repos/mboom/TI2806/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mboom/TI2806/issues/124/comments","statuses_url":"https://api.github.com/repos/mboom/TI2806/statuses/c4e87f7f91b128842f0509d06996e7ba532f504a","head":{"label":"mboom:data-visualization-1","ref":"data-visualization-1","sha":"c4e87f7f91b128842f0509d06996e7ba532f504a","user":{"login":"mboom","id":9715349,"avatar_url":"https://avatars.githubusercontent.com/u/9715349?v=3","gravatar_id":"","url":"https://api.github.com/users/mboom","html_url":"https://github.com/mboom","followers_url":"https://api.github.com/users/mboom/followers","following_url":"https://api.github.com/users/mboom/following{/other_user}","gists_url":"https://api.github.com/users/mboom/gists{/gist_id}","starred_url":"https://api.github.com/users/mboom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mboom/subscriptions","organizations_url":"https://api.github.com/users/mboom/orgs","repos_url":"https://api.github.com/users/mboom/repos","events_url":"https://api.github.com/users/mboom/events{/privacy}","received_events_url":"https://api.github.com/users/mboom/received_events","type":"User","site_admin":false},"repo":{"id":56750401,"name":"TI2806","full_name":"mboom/TI2806","owner":{"login":"mboom","id":9715349,"avatar_url":"https://avatars.githubusercontent.com/u/9715349?v=3","gravatar_id":"","url":"https://api.github.com/users/mboom","html_url":"https://github.com/mboom","followers_url":"https://api.github.com/users/mboom/followers","following_url":"https://api.github.com/users/mboom/following{/other_user}","gists_url":"https://api.github.com/users/mboom/gists{/gist_id}","starred_url":"https://api.github.com/users/mboom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mboom/subscriptions","organizations_url":"https://api.github.com/users/mboom/orgs","repos_url":"https://api.github.com/users/mboom/repos","events_url":"https://api.github.com/users/mboom/events{/privacy}","received_events_url":"https://api.github.com/users/mboom/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mboom/TI2806","description":"Tools for Software Engineering","fork":false,"url":"https://api.github.com/repos/mboom/TI2806","forks_url":"https://api.github.com/repos/mboom/TI2806/forks","keys_url":"https://api.github.com/repos/mboom/TI2806/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mboom/TI2806/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mboom/TI2806/teams","hooks_url":"https://api.github.com/repos/mboom/TI2806/hooks","issue_events_url":"https://api.github.com/repos/mboom/TI2806/issues/events{/number}","events_url":"https://api.github.com/repos/mboom/TI2806/events","assignees_url":"https://api.github.com/repos/mboom/TI2806/assignees{/user}","branches_url":"https://api.github.com/repos/mboom/TI2806/branches{/branch}","tags_url":"https://api.github.com/repos/mboom/TI2806/tags","blobs_url":"https://api.github.com/repos/mboom/TI2806/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mboom/TI2806/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mboom/TI2806/git/refs{/sha}","trees_url":"https://api.github.com/repos/mboom/TI2806/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mboom/TI2806/statuses/{sha}","languages_url":"https://api.github.com/repos/mboom/TI2806/languages","stargazers_url":"https://api.github.com/repos/mboom/TI2806/stargazers","contributors_url":"https://api.github.com/repos/mboom/TI2806/contributors","subscribers_url":"https://api.github.com/repos/mboom/TI2806/subscribers","subscription_url":"https://api.github.com/repos/mboom/TI2806/subscription","commits_url":"https://api.github.com/repos/mboom/TI2806/commits{/sha}","git_commits_url":"https://api.github.com/repos/mboom/TI2806/git/commits{/sha}","comments_url":"https://api.github.com/repos/mboom/TI2806/comments{/number}","issue_comment_url":"https://api.github.com/repos/mboom/TI2806/issues/comments{/number}","contents_url":"https://api.github.com/repos/mboom/TI2806/contents/{+path}","compare_url":"https://api.github.com/repos/mboom/TI2806/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mboom/TI2806/merges","archive_url":"https://api.github.com/repos/mboom/TI2806/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mboom/TI2806/downloads","issues_url":"https://api.github.com/repos/mboom/TI2806/issues{/number}","pulls_url":"https://api.github.com/repos/mboom/TI2806/pulls{/number}","milestones_url":"https://api.github.com/repos/mboom/TI2806/milestones{/number}","notifications_url":"https://api.github.com/repos/mboom/TI2806/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mboom/TI2806/labels{/name}","releases_url":"https://api.github.com/repos/mboom/TI2806/releases{/id}","deployments_url":"https://api.github.com/repos/mboom/TI2806/deployments","created_at":"2016-04-21T07:03:58Z","updated_at":"2016-04-21T10:00:55Z","pushed_at":"2016-05-24T10:08:13Z","git_url":"git://github.com/mboom/TI2806.git","ssh_url":"git@github.com:mboom/TI2806.git","clone_url":"https://github.com/mboom/TI2806.git","svn_url":"https://github.com/mboom/TI2806","homepage":null,"size":4347,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":15,"forks":1,"open_issues":15,"watchers":0,"default_branch":"master"}},"base":{"label":"mboom:master","ref":"master","sha":"5a5ffeb9fca6e02b81a50db2e834d28dddae18e6","user":{"login":"mboom","id":9715349,"avatar_url":"https://avatars.githubusercontent.com/u/9715349?v=3","gravatar_id":"","url":"https://api.github.com/users/mboom","html_url":"https://github.com/mboom","followers_url":"https://api.github.com/users/mboom/followers","following_url":"https://api.github.com/users/mboom/following{/other_user}","gists_url":"https://api.github.com/users/mboom/gists{/gist_id}","starred_url":"https://api.github.com/users/mboom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mboom/subscriptions","organizations_url":"https://api.github.com/users/mboom/orgs","repos_url":"https://api.github.com/users/mboom/repos","events_url":"https://api.github.com/users/mboom/events{/privacy}","received_events_url":"https://api.github.com/users/mboom/received_events","type":"User","site_admin":false},"repo":{"id":56750401,"name":"TI2806","full_name":"mboom/TI2806","owner":{"login":"mboom","id":9715349,"avatar_url":"https://avatars.githubusercontent.com/u/9715349?v=3","gravatar_id":"","url":"https://api.github.com/users/mboom","html_url":"https://github.com/mboom","followers_url":"https://api.github.com/users/mboom/followers","following_url":"https://api.github.com/users/mboom/following{/other_user}","gists_url":"https://api.github.com/users/mboom/gists{/gist_id}","starred_url":"https://api.github.com/users/mboom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mboom/subscriptions","organizations_url":"https://api.github.com/users/mboom/orgs","repos_url":"https://api.github.com/users/mboom/repos","events_url":"https://api.github.com/users/mboom/events{/privacy}","received_events_url":"https://api.github.com/users/mboom/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mboom/TI2806","description":"Tools for Software Engineering","fork":false,"url":"https://api.github.com/repos/mboom/TI2806","forks_url":"https://api.github.com/repos/mboom/TI2806/forks","keys_url":"https://api.github.com/repos/mboom/TI2806/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mboom/TI2806/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mboom/TI2806/teams","hooks_url":"https://api.github.com/repos/mboom/TI2806/hooks","issue_events_url":"https://api.github.com/repos/mboom/TI2806/issues/events{/number}","events_url":"https://api.github.com/repos/mboom/TI2806/events","assignees_url":"https://api.github.com/repos/mboom/TI2806/assignees{/user}","branches_url":"https://api.github.com/repos/mboom/TI2806/branches{/branch}","tags_url":"https://api.github.com/repos/mboom/TI2806/tags","blobs_url":"https://api.github.com/repos/mboom/TI2806/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mboom/TI2806/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mboom/TI2806/git/refs{/sha}","trees_url":"https://api.github.com/repos/mboom/TI2806/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mboom/TI2806/statuses/{sha}","languages_url":"https://api.github.com/repos/mboom/TI2806/languages","stargazers_url":"https://api.github.com/repos/mboom/TI2806/stargazers","contributors_url":"https://api.github.com/repos/mboom/TI2806/contributors","subscribers_url":"https://api.github.com/repos/mboom/TI2806/subscribers","subscription_url":"https://api.github.com/repos/mboom/TI2806/subscription","commits_url":"https://api.github.com/repos/mboom/TI2806/commits{/sha}","git_commits_url":"https://api.github.com/repos/mboom/TI2806/git/commits{/sha}","comments_url":"https://api.github.com/repos/mboom/TI2806/comments{/number}","issue_comment_url":"https://api.github.com/repos/mboom/TI2806/issues/comments{/number}","contents_url":"https://api.github.com/repos/mboom/TI2806/contents/{+path}","compare_url":"https://api.github.com/repos/mboom/TI2806/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mboom/TI2806/merges","archive_url":"https://api.github.com/repos/mboom/TI2806/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mboom/TI2806/downloads","issues_url":"https://api.github.com/repos/mboom/TI2806/issues{/number}","pulls_url":"https://api.github.com/repos/mboom/TI2806/pulls{/number}","milestones_url":"https://api.github.com/repos/mboom/TI2806/milestones{/number}","notifications_url":"https://api.github.com/repos/mboom/TI2806/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mboom/TI2806/labels{/name}","releases_url":"https://api.github.com/repos/mboom/TI2806/releases{/id}","deployments_url":"https://api.github.com/repos/mboom/TI2806/deployments","created_at":"2016-04-21T07:03:58Z","updated_at":"2016-04-21T10:00:55Z","pushed_at":"2016-05-24T10:08:13Z","git_url":"git://github.com/mboom/TI2806.git","ssh_url":"git@github.com:mboom/TI2806.git","clone_url":"https://github.com/mboom/TI2806.git","svn_url":"https://github.com/mboom/TI2806","homepage":null,"size":4347,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":15,"forks":1,"open_issues":15,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mboom/TI2806/pulls/124"},"html":{"href":"https://github.com/mboom/TI2806/pull/124"},"issue":{"href":"https://api.github.com/repos/mboom/TI2806/issues/124"},"comments":{"href":"https://api.github.com/repos/mboom/TI2806/issues/124/comments"},"review_comments":{"href":"https://api.github.com/repos/mboom/TI2806/pulls/124/comments"},"review_comment":{"href":"https://api.github.com/repos/mboom/TI2806/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mboom/TI2806/pulls/124/commits"},"statuses":{"href":"https://api.github.com/repos/mboom/TI2806/statuses/c4e87f7f91b128842f0509d06996e7ba532f504a"}}}}
{"actor":{"display_login":"DaanvanderValk"}}