{"action":"created","comment":{"url":"https://api.github.com/repos/cul-2016/quiz/pulls/comments/77915766","id":77915766,"diff_hunk":"@@ -0,0 +1,38 @@\n+var quantileSorted = require('simple-statistics').quantileSorted;\n+\n+/**\n+ * A function that returns an array of the lowest student score\n+ * for each percentile range\n+ * @param {array} averageScores - the average scores for all students\n+ * @param {array} boundaries - array of numbers representing the top-end of a percentile range.  E.g. 11%-25% is represented by 25.\n+ * @param {function} callback - a callback function\n+ */\n+\n+\n+function getPercentileValues (averageScores, boundaries, callback) {\n+\n+    if (!averageScores.length || !boundaries.length) {\n+        return callback(new Error('Arguments must be arrays of length > 0'));\n+    }\n+\n+    let sample = averageScores.map((elem) => {\n+        return elem.average;\n+    });\n+    let boundariesAsDecimal = boundaries.map((boundary) => {\n+        return boundary / 100;\n+    });\n+    let values = [];\n+\n+    (function getPercentile (remainingBoundaries, result) {\n+\n+        if (!remainingBoundaries.length) {\n+            return callback(null, result);\n+        }\n+        result.push(quantileSorted(sample, remainingBoundaries[0]));\n+\n+        getPercentile(remainingBoundaries.slice(1), result);\n+    })(boundariesAsDecimal, values);\n+}","path":"server/lib/getPercentileValues.js","position":35,"original_position":35,"commit_id":"0135da7f68ff07d694fb88ddc92c5e77d57434f0","original_commit_id":"0135da7f68ff07d694fb88ddc92c5e77d57434f0","user":{"login":"sohilpandya","id":2305591,"avatar_url":"https://avatars.githubusercontent.com/u/2305591?v=3","gravatar_id":"","url":"https://api.github.com/users/sohilpandya","html_url":"https://github.com/sohilpandya","followers_url":"https://api.github.com/users/sohilpandya/followers","following_url":"https://api.github.com/users/sohilpandya/following{/other_user}","gists_url":"https://api.github.com/users/sohilpandya/gists{/gist_id}","starred_url":"https://api.github.com/users/sohilpandya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sohilpandya/subscriptions","organizations_url":"https://api.github.com/users/sohilpandya/orgs","repos_url":"https://api.github.com/users/sohilpandya/repos","events_url":"https://api.github.com/users/sohilpandya/events{/privacy}","received_events_url":"https://api.github.com/users/sohilpandya/received_events","type":"User","site_admin":false},"body":"Took me a while to get through this function, theres tonnes going on in here. \r\n\r\npotentially add the link to http://simplestatistics.org/docs/#quantileSorted so that we know what is returned from the quantileSorted function, for those who are not statisticians. \r\n","created_at":"2016-09-07T22:24:51Z","updated_at":"2016-09-07T22:24:51Z","html_url":"https://github.com/cul-2016/quiz/pull/153#discussion_r77915766","pull_request_url":"https://api.github.com/repos/cul-2016/quiz/pulls/153","_links":{"self":{"href":"https://api.github.com/repos/cul-2016/quiz/pulls/comments/77915766"},"html":{"href":"https://github.com/cul-2016/quiz/pull/153#discussion_r77915766"},"pull_request":{"href":"https://api.github.com/repos/cul-2016/quiz/pulls/153"}}},"pull_request":{"url":"https://api.github.com/repos/cul-2016/quiz/pulls/153","id":84295291,"html_url":"https://github.com/cul-2016/quiz/pull/153","diff_url":"https://github.com/cul-2016/quiz/pull/153.diff","patch_url":"https://github.com/cul-2016/quiz/pull/153.patch","issue_url":"https://api.github.com/repos/cul-2016/quiz/issues/153","number":153,"state":"open","locked":false,"title":"Feedback","user":{"login":"minaorangina","id":8915092,"avatar_url":"https://avatars.githubusercontent.com/u/8915092?v=3","gravatar_id":"","url":"https://api.github.com/users/minaorangina","html_url":"https://github.com/minaorangina","followers_url":"https://api.github.com/users/minaorangina/followers","following_url":"https://api.github.com/users/minaorangina/following{/other_user}","gists_url":"https://api.github.com/users/minaorangina/gists{/gist_id}","starred_url":"https://api.github.com/users/minaorangina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minaorangina/subscriptions","organizations_url":"https://api.github.com/users/minaorangina/orgs","repos_url":"https://api.github.com/users/minaorangina/repos","events_url":"https://api.github.com/users/minaorangina/events{/privacy}","received_events_url":"https://api.github.com/users/minaorangina/received_events","type":"User","site_admin":false},"body":"This completes the functionality to satisfy #60 ","created_at":"2016-09-07T12:59:00Z","updated_at":"2016-09-07T22:24:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"74f1b11563e25e51b0cc095a575e6e9e6799900f","assignee":{"login":"sohilpandya","id":2305591,"avatar_url":"https://avatars.githubusercontent.com/u/2305591?v=3","gravatar_id":"","url":"https://api.github.com/users/sohilpandya","html_url":"https://github.com/sohilpandya","followers_url":"https://api.github.com/users/sohilpandya/followers","following_url":"https://api.github.com/users/sohilpandya/following{/other_user}","gists_url":"https://api.github.com/users/sohilpandya/gists{/gist_id}","starred_url":"https://api.github.com/users/sohilpandya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sohilpandya/subscriptions","organizations_url":"https://api.github.com/users/sohilpandya/orgs","repos_url":"https://api.github.com/users/sohilpandya/repos","events_url":"https://api.github.com/users/sohilpandya/events{/privacy}","received_events_url":"https://api.github.com/users/sohilpandya/received_events","type":"User","site_admin":false},"assignees":[{"login":"sohilpandya","id":2305591,"avatar_url":"https://avatars.githubusercontent.com/u/2305591?v=3","gravatar_id":"","url":"https://api.github.com/users/sohilpandya","html_url":"https://github.com/sohilpandya","followers_url":"https://api.github.com/users/sohilpandya/followers","following_url":"https://api.github.com/users/sohilpandya/following{/other_user}","gists_url":"https://api.github.com/users/sohilpandya/gists{/gist_id}","starred_url":"https://api.github.com/users/sohilpandya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sohilpandya/subscriptions","organizations_url":"https://api.github.com/users/sohilpandya/orgs","repos_url":"https://api.github.com/users/sohilpandya/repos","events_url":"https://api.github.com/users/sohilpandya/events{/privacy}","received_events_url":"https://api.github.com/users/sohilpandya/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/cul-2016/quiz/milestones/4","html_url":"https://github.com/cul-2016/quiz/milestones/Sprint%203","labels_url":"https://api.github.com/repos/cul-2016/quiz/milestones/4/labels","id":1927485,"number":4,"title":"Sprint 3","description":"","creator":{"login":"minaorangina","id":8915092,"avatar_url":"https://avatars.githubusercontent.com/u/8915092?v=3","gravatar_id":"","url":"https://api.github.com/users/minaorangina","html_url":"https://github.com/minaorangina","followers_url":"https://api.github.com/users/minaorangina/followers","following_url":"https://api.github.com/users/minaorangina/following{/other_user}","gists_url":"https://api.github.com/users/minaorangina/gists{/gist_id}","starred_url":"https://api.github.com/users/minaorangina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minaorangina/subscriptions","organizations_url":"https://api.github.com/users/minaorangina/orgs","repos_url":"https://api.github.com/users/minaorangina/repos","events_url":"https://api.github.com/users/minaorangina/events{/privacy}","received_events_url":"https://api.github.com/users/minaorangina/received_events","type":"User","site_admin":false},"open_issues":28,"closed_issues":54,"state":"open","created_at":"2016-08-07T11:30:03Z","updated_at":"2016-09-07T14:49:05Z","due_on":"2016-08-26T00:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/cul-2016/quiz/pulls/153/commits","review_comments_url":"https://api.github.com/repos/cul-2016/quiz/pulls/153/comments","review_comment_url":"https://api.github.com/repos/cul-2016/quiz/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cul-2016/quiz/issues/153/comments","statuses_url":"https://api.github.com/repos/cul-2016/quiz/statuses/0135da7f68ff07d694fb88ddc92c5e77d57434f0","head":{"label":"cul-2016:feedback","ref":"feedback","sha":"0135da7f68ff07d694fb88ddc92c5e77d57434f0","user":{"login":"cul-2016","id":20283459,"avatar_url":"https://avatars.githubusercontent.com/u/20283459?v=3","gravatar_id":"","url":"https://api.github.com/users/cul-2016","html_url":"https://github.com/cul-2016","followers_url":"https://api.github.com/users/cul-2016/followers","following_url":"https://api.github.com/users/cul-2016/following{/other_user}","gists_url":"https://api.github.com/users/cul-2016/gists{/gist_id}","starred_url":"https://api.github.com/users/cul-2016/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cul-2016/subscriptions","organizations_url":"https://api.github.com/users/cul-2016/orgs","repos_url":"https://api.github.com/users/cul-2016/repos","events_url":"https://api.github.com/users/cul-2016/events{/privacy}","received_events_url":"https://api.github.com/users/cul-2016/received_events","type":"Organization","site_admin":false},"repo":{"id":62564343,"name":"quiz","full_name":"cul-2016/quiz","owner":{"login":"cul-2016","id":20283459,"avatar_url":"https://avatars.githubusercontent.com/u/20283459?v=3","gravatar_id":"","url":"https://api.github.com/users/cul-2016","html_url":"https://github.com/cul-2016","followers_url":"https://api.github.com/users/cul-2016/followers","following_url":"https://api.github.com/users/cul-2016/following{/other_user}","gists_url":"https://api.github.com/users/cul-2016/gists{/gist_id}","starred_url":"https://api.github.com/users/cul-2016/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cul-2016/subscriptions","organizations_url":"https://api.github.com/users/cul-2016/orgs","repos_url":"https://api.github.com/users/cul-2016/repos","events_url":"https://api.github.com/users/cul-2016/events{/privacy}","received_events_url":"https://api.github.com/users/cul-2016/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cul-2016/quiz","description":null,"fork":false,"url":"https://api.github.com/repos/cul-2016/quiz","forks_url":"https://api.github.com/repos/cul-2016/quiz/forks","keys_url":"https://api.github.com/repos/cul-2016/quiz/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cul-2016/quiz/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cul-2016/quiz/teams","hooks_url":"https://api.github.com/repos/cul-2016/quiz/hooks","issue_events_url":"https://api.github.com/repos/cul-2016/quiz/issues/events{/number}","events_url":"https://api.github.com/repos/cul-2016/quiz/events","assignees_url":"https://api.github.com/repos/cul-2016/quiz/assignees{/user}","branches_url":"https://api.github.com/repos/cul-2016/quiz/branches{/branch}","tags_url":"https://api.github.com/repos/cul-2016/quiz/tags","blobs_url":"https://api.github.com/repos/cul-2016/quiz/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cul-2016/quiz/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cul-2016/quiz/git/refs{/sha}","trees_url":"https://api.github.com/repos/cul-2016/quiz/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cul-2016/quiz/statuses/{sha}","languages_url":"https://api.github.com/repos/cul-2016/quiz/languages","stargazers_url":"https://api.github.com/repos/cul-2016/quiz/stargazers","contributors_url":"https://api.github.com/repos/cul-2016/quiz/contributors","subscribers_url":"https://api.github.com/repos/cul-2016/quiz/subscribers","subscription_url":"https://api.github.com/repos/cul-2016/quiz/subscription","commits_url":"https://api.github.com/repos/cul-2016/quiz/commits{/sha}","git_commits_url":"https://api.github.com/repos/cul-2016/quiz/git/commits{/sha}","comments_url":"https://api.github.com/repos/cul-2016/quiz/comments{/number}","issue_comment_url":"https://api.github.com/repos/cul-2016/quiz/issues/comments{/number}","contents_url":"https://api.github.com/repos/cul-2016/quiz/contents/{+path}","compare_url":"https://api.github.com/repos/cul-2016/quiz/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cul-2016/quiz/merges","archive_url":"https://api.github.com/repos/cul-2016/quiz/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cul-2016/quiz/downloads","issues_url":"https://api.github.com/repos/cul-2016/quiz/issues{/number}","pulls_url":"https://api.github.com/repos/cul-2016/quiz/pulls{/number}","milestones_url":"https://api.github.com/repos/cul-2016/quiz/milestones{/number}","notifications_url":"https://api.github.com/repos/cul-2016/quiz/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cul-2016/quiz/labels{/name}","releases_url":"https://api.github.com/repos/cul-2016/quiz/releases{/id}","deployments_url":"https://api.github.com/repos/cul-2016/quiz/deployments","created_at":"2016-07-04T13:29:33Z","updated_at":"2016-08-11T12:11:20Z","pushed_at":"2016-09-07T22:09:52Z","git_url":"git://github.com/cul-2016/quiz.git","ssh_url":"git@github.com:cul-2016/quiz.git","clone_url":"https://github.com/cul-2016/quiz.git","svn_url":"https://github.com/cul-2016/quiz","homepage":null,"size":2013,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":70,"forks":0,"open_issues":70,"watchers":0,"default_branch":"staging"}},"base":{"label":"cul-2016:staging","ref":"staging","sha":"2d73236b5caecc45a194972f13ed765457794a33","user":{"login":"cul-2016","id":20283459,"avatar_url":"https://avatars.githubusercontent.com/u/20283459?v=3","gravatar_id":"","url":"https://api.github.com/users/cul-2016","html_url":"https://github.com/cul-2016","followers_url":"https://api.github.com/users/cul-2016/followers","following_url":"https://api.github.com/users/cul-2016/following{/other_user}","gists_url":"https://api.github.com/users/cul-2016/gists{/gist_id}","starred_url":"https://api.github.com/users/cul-2016/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cul-2016/subscriptions","organizations_url":"https://api.github.com/users/cul-2016/orgs","repos_url":"https://api.github.com/users/cul-2016/repos","events_url":"https://api.github.com/users/cul-2016/events{/privacy}","received_events_url":"https://api.github.com/users/cul-2016/received_events","type":"Organization","site_admin":false},"repo":{"id":62564343,"name":"quiz","full_name":"cul-2016/quiz","owner":{"login":"cul-2016","id":20283459,"avatar_url":"https://avatars.githubusercontent.com/u/20283459?v=3","gravatar_id":"","url":"https://api.github.com/users/cul-2016","html_url":"https://github.com/cul-2016","followers_url":"https://api.github.com/users/cul-2016/followers","following_url":"https://api.github.com/users/cul-2016/following{/other_user}","gists_url":"https://api.github.com/users/cul-2016/gists{/gist_id}","starred_url":"https://api.github.com/users/cul-2016/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cul-2016/subscriptions","organizations_url":"https://api.github.com/users/cul-2016/orgs","repos_url":"https://api.github.com/users/cul-2016/repos","events_url":"https://api.github.com/users/cul-2016/events{/privacy}","received_events_url":"https://api.github.com/users/cul-2016/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cul-2016/quiz","description":null,"fork":false,"url":"https://api.github.com/repos/cul-2016/quiz","forks_url":"https://api.github.com/repos/cul-2016/quiz/forks","keys_url":"https://api.github.com/repos/cul-2016/quiz/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cul-2016/quiz/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cul-2016/quiz/teams","hooks_url":"https://api.github.com/repos/cul-2016/quiz/hooks","issue_events_url":"https://api.github.com/repos/cul-2016/quiz/issues/events{/number}","events_url":"https://api.github.com/repos/cul-2016/quiz/events","assignees_url":"https://api.github.com/repos/cul-2016/quiz/assignees{/user}","branches_url":"https://api.github.com/repos/cul-2016/quiz/branches{/branch}","tags_url":"https://api.github.com/repos/cul-2016/quiz/tags","blobs_url":"https://api.github.com/repos/cul-2016/quiz/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cul-2016/quiz/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cul-2016/quiz/git/refs{/sha}","trees_url":"https://api.github.com/repos/cul-2016/quiz/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cul-2016/quiz/statuses/{sha}","languages_url":"https://api.github.com/repos/cul-2016/quiz/languages","stargazers_url":"https://api.github.com/repos/cul-2016/quiz/stargazers","contributors_url":"https://api.github.com/repos/cul-2016/quiz/contributors","subscribers_url":"https://api.github.com/repos/cul-2016/quiz/subscribers","subscription_url":"https://api.github.com/repos/cul-2016/quiz/subscription","commits_url":"https://api.github.com/repos/cul-2016/quiz/commits{/sha}","git_commits_url":"https://api.github.com/repos/cul-2016/quiz/git/commits{/sha}","comments_url":"https://api.github.com/repos/cul-2016/quiz/comments{/number}","issue_comment_url":"https://api.github.com/repos/cul-2016/quiz/issues/comments{/number}","contents_url":"https://api.github.com/repos/cul-2016/quiz/contents/{+path}","compare_url":"https://api.github.com/repos/cul-2016/quiz/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cul-2016/quiz/merges","archive_url":"https://api.github.com/repos/cul-2016/quiz/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cul-2016/quiz/downloads","issues_url":"https://api.github.com/repos/cul-2016/quiz/issues{/number}","pulls_url":"https://api.github.com/repos/cul-2016/quiz/pulls{/number}","milestones_url":"https://api.github.com/repos/cul-2016/quiz/milestones{/number}","notifications_url":"https://api.github.com/repos/cul-2016/quiz/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cul-2016/quiz/labels{/name}","releases_url":"https://api.github.com/repos/cul-2016/quiz/releases{/id}","deployments_url":"https://api.github.com/repos/cul-2016/quiz/deployments","created_at":"2016-07-04T13:29:33Z","updated_at":"2016-08-11T12:11:20Z","pushed_at":"2016-09-07T22:09:52Z","git_url":"git://github.com/cul-2016/quiz.git","ssh_url":"git@github.com:cul-2016/quiz.git","clone_url":"https://github.com/cul-2016/quiz.git","svn_url":"https://github.com/cul-2016/quiz","homepage":null,"size":2013,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":70,"forks":0,"open_issues":70,"watchers":0,"default_branch":"staging"}},"_links":{"self":{"href":"https://api.github.com/repos/cul-2016/quiz/pulls/153"},"html":{"href":"https://github.com/cul-2016/quiz/pull/153"},"issue":{"href":"https://api.github.com/repos/cul-2016/quiz/issues/153"},"comments":{"href":"https://api.github.com/repos/cul-2016/quiz/issues/153/comments"},"review_comments":{"href":"https://api.github.com/repos/cul-2016/quiz/pulls/153/comments"},"review_comment":{"href":"https://api.github.com/repos/cul-2016/quiz/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cul-2016/quiz/pulls/153/commits"},"statuses":{"href":"https://api.github.com/repos/cul-2016/quiz/statuses/0135da7f68ff07d694fb88ddc92c5e77d57434f0"}}}}
{"actor":{"display_login":"sohilpandya"}}