{"action":"created","comment":{"url":"https://api.github.com/repos/edx/gradebook/pulls/comments/233602175","pull_request_review_id":175052547,"id":233602175,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMzYwMjE3NQ==","diff_hunk":"@@ -32,15 +35,149 @@ const gradeUpdateFailure = error => ({\n \n \n const toggleGradeFormat = formatType => ({ type: TOGGLE_GRADE_FORMAT, formatType });\n+const sortGrades = (columnName, direction) => ({ type: SORT_GRADES, columnName, direction });\n \n+const sortAlphaDesc = (gradeRowA, gradeRowB) => {\n+  const a = gradeRowA.username.toUpperCase();\n+  const b = gradeRowB.username.toUpperCase();\n+  if (a < b) {\n+    return -1;\n+  }\n+  if (a > b) {\n+    return 1;\n+  }\n+  return 0;\n+};\n+\n+const sortAlphaAsc = (gradeRowA, gradeRowB) => {\n+  const a = gradeRowA.username.toUpperCase();\n+  const b = gradeRowB.username.toUpperCase();\n+  if (a < b) {\n+    return 1;\n+  }\n+  if (a > b) {\n+    return -1;\n+  }\n+  return 0;\n+};\n+\n+const sortNumerically = (colKey, direction) => {\n+  function sortNumAsc(gradeRowA, gradeRowB) {\n+    if (gradeRowA[colKey] < gradeRowB[colKey]) {\n+      return -1;\n+    }\n+    if (gradeRowA[colKey] > gradeRowB[colKey]) {\n+      return 1;\n+    }\n+    return 0;\n+  }\n+\n+  function sortNumDesc(gradeRowA, gradeRowB) {\n+    if (gradeRowA[colKey] < gradeRowB[colKey]) {\n+      return 1;\n+    }\n+    if (gradeRowA[colKey] > gradeRowB[colKey]) {\n+      return -1;\n+    }\n+    return 0;\n+  }\n+\n+  this.setState({ grades: [...this.state.grades].sort(direction === 'desc' ? sortNumDesc : sortNumAsc) });\n+};\n+const headingMapper = {","path":"src/data/actions/grades.js","position":75,"original_position":75,"commit_id":"5ff7a0945cdf6685ce07736faf51dd78d143d635","original_commit_id":"5ff7a0945cdf6685ce07736faf51dd78d143d635","user":{"login":"schenedx","id":16839373,"node_id":"MDQ6VXNlcjE2ODM5Mzcz","avatar_url":"https://avatars3.githubusercontent.com/u/16839373?v=4","gravatar_id":"","url":"https://api.github.com/users/schenedx","html_url":"https://github.com/schenedx","followers_url":"https://api.github.com/users/schenedx/followers","following_url":"https://api.github.com/users/schenedx/following{/other_user}","gists_url":"https://api.github.com/users/schenedx/gists{/gist_id}","starred_url":"https://api.github.com/users/schenedx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schenedx/subscriptions","organizations_url":"https://api.github.com/users/schenedx/orgs","repos_url":"https://api.github.com/users/schenedx/repos","events_url":"https://api.github.com/users/schenedx/events{/privacy}","received_events_url":"https://api.github.com/users/schenedx/received_events","type":"User","site_admin":false},"body":"Move this into a util module so it an be shared by both the grade.js and filter.js","created_at":"2018-11-14T20:10:28Z","updated_at":"2018-11-14T20:11:13Z","html_url":"https://github.com/edx/gradebook/pull/15#discussion_r233602175","pull_request_url":"https://api.github.com/repos/edx/gradebook/pulls/15","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/edx/gradebook/pulls/comments/233602175"},"html":{"href":"https://github.com/edx/gradebook/pull/15#discussion_r233602175"},"pull_request":{"href":"https://api.github.com/repos/edx/gradebook/pulls/15"}}},"pull_request":{"url":"https://api.github.com/repos/edx/gradebook/pulls/15","id":230961261,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMwOTYxMjYx","html_url":"https://github.com/edx/gradebook/pull/15","diff_url":"https://github.com/edx/gradebook/pull/15.diff","patch_url":"https://github.com/edx/gradebook/pull/15.patch","issue_url":"https://api.github.com/repos/edx/gradebook/issues/15","number":15,"state":"open","locked":false,"title":"Rir/fix category filter","user":{"login":"reillz10","id":11048849,"node_id":"MDQ6VXNlcjExMDQ4ODQ5","avatar_url":"https://avatars2.githubusercontent.com/u/11048849?v=4","gravatar_id":"","url":"https://api.github.com/users/reillz10","html_url":"https://github.com/reillz10","followers_url":"https://api.github.com/users/reillz10/followers","following_url":"https://api.github.com/users/reillz10/following{/other_user}","gists_url":"https://api.github.com/users/reillz10/gists{/gist_id}","starred_url":"https://api.github.com/users/reillz10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reillz10/subscriptions","organizations_url":"https://api.github.com/users/reillz10/orgs","repos_url":"https://api.github.com/users/reillz10/repos","events_url":"https://api.github.com/users/reillz10/events{/privacy}","received_events_url":"https://api.github.com/users/reillz10/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-11-14T19:54:15Z","updated_at":"2018-11-14T20:11:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"73ab682223d9d6a71e76fba3391eb9b36c654ce7","assignee":null,"assignees":[],"requested_reviewers":[{"login":"iloveagent57","id":2307986,"node_id":"MDQ6VXNlcjIzMDc5ODY=","avatar_url":"https://avatars2.githubusercontent.com/u/2307986?v=4","gravatar_id":"","url":"https://api.github.com/users/iloveagent57","html_url":"https://github.com/iloveagent57","followers_url":"https://api.github.com/users/iloveagent57/followers","following_url":"https://api.github.com/users/iloveagent57/following{/other_user}","gists_url":"https://api.github.com/users/iloveagent57/gists{/gist_id}","starred_url":"https://api.github.com/users/iloveagent57/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iloveagent57/subscriptions","organizations_url":"https://api.github.com/users/iloveagent57/orgs","repos_url":"https://api.github.com/users/iloveagent57/repos","events_url":"https://api.github.com/users/iloveagent57/events{/privacy}","received_events_url":"https://api.github.com/users/iloveagent57/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/edx/gradebook/pulls/15/commits","review_comments_url":"https://api.github.com/repos/edx/gradebook/pulls/15/comments","review_comment_url":"https://api.github.com/repos/edx/gradebook/pulls/comments{/number}","comments_url":"https://api.github.com/repos/edx/gradebook/issues/15/comments","statuses_url":"https://api.github.com/repos/edx/gradebook/statuses/5ff7a0945cdf6685ce07736faf51dd78d143d635","head":{"label":"edx:rir/fix-category-filter","ref":"rir/fix-category-filter","sha":"5ff7a0945cdf6685ce07736faf51dd78d143d635","user":{"login":"edx","id":3179841,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMxNzk4NDE=","avatar_url":"https://avatars3.githubusercontent.com/u/3179841?v=4","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":153483450,"node_id":"MDEwOlJlcG9zaXRvcnkxNTM0ODM0NTA=","name":"gradebook","full_name":"edx/gradebook","private":false,"owner":{"login":"edx","id":3179841,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMxNzk4NDE=","avatar_url":"https://avatars3.githubusercontent.com/u/3179841?v=4","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/edx/gradebook","description":"Instructor gradebook tool for Master's programs","fork":false,"url":"https://api.github.com/repos/edx/gradebook","forks_url":"https://api.github.com/repos/edx/gradebook/forks","keys_url":"https://api.github.com/repos/edx/gradebook/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/gradebook/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/gradebook/teams","hooks_url":"https://api.github.com/repos/edx/gradebook/hooks","issue_events_url":"https://api.github.com/repos/edx/gradebook/issues/events{/number}","events_url":"https://api.github.com/repos/edx/gradebook/events","assignees_url":"https://api.github.com/repos/edx/gradebook/assignees{/user}","branches_url":"https://api.github.com/repos/edx/gradebook/branches{/branch}","tags_url":"https://api.github.com/repos/edx/gradebook/tags","blobs_url":"https://api.github.com/repos/edx/gradebook/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/gradebook/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/gradebook/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/gradebook/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/gradebook/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/gradebook/languages","stargazers_url":"https://api.github.com/repos/edx/gradebook/stargazers","contributors_url":"https://api.github.com/repos/edx/gradebook/contributors","subscribers_url":"https://api.github.com/repos/edx/gradebook/subscribers","subscription_url":"https://api.github.com/repos/edx/gradebook/subscription","commits_url":"https://api.github.com/repos/edx/gradebook/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/gradebook/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/gradebook/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/gradebook/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/gradebook/contents/{+path}","compare_url":"https://api.github.com/repos/edx/gradebook/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/gradebook/merges","archive_url":"https://api.github.com/repos/edx/gradebook/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/gradebook/downloads","issues_url":"https://api.github.com/repos/edx/gradebook/issues{/number}","pulls_url":"https://api.github.com/repos/edx/gradebook/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/gradebook/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/gradebook/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/gradebook/labels{/name}","releases_url":"https://api.github.com/repos/edx/gradebook/releases{/id}","deployments_url":"https://api.github.com/repos/edx/gradebook/deployments","created_at":"2018-10-17T15:49:15Z","updated_at":"2018-11-14T19:50:43Z","pushed_at":"2018-11-14T19:55:23Z","git_url":"git://github.com/edx/gradebook.git","ssh_url":"git@github.com:edx/gradebook.git","clone_url":"https://github.com/edx/gradebook.git","svn_url":"https://github.com/edx/gradebook","homepage":"","size":637,"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":0,"mirror_url":null,"archived":false,"open_issues_count":3,"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":0,"open_issues":3,"watchers":2,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"df32123f3490c64a12826a8d06f5367040817394","user":{"login":"edx","id":3179841,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMxNzk4NDE=","avatar_url":"https://avatars3.githubusercontent.com/u/3179841?v=4","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":153483450,"node_id":"MDEwOlJlcG9zaXRvcnkxNTM0ODM0NTA=","name":"gradebook","full_name":"edx/gradebook","private":false,"owner":{"login":"edx","id":3179841,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMxNzk4NDE=","avatar_url":"https://avatars3.githubusercontent.com/u/3179841?v=4","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/edx/gradebook","description":"Instructor gradebook tool for Master's programs","fork":false,"url":"https://api.github.com/repos/edx/gradebook","forks_url":"https://api.github.com/repos/edx/gradebook/forks","keys_url":"https://api.github.com/repos/edx/gradebook/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/gradebook/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/gradebook/teams","hooks_url":"https://api.github.com/repos/edx/gradebook/hooks","issue_events_url":"https://api.github.com/repos/edx/gradebook/issues/events{/number}","events_url":"https://api.github.com/repos/edx/gradebook/events","assignees_url":"https://api.github.com/repos/edx/gradebook/assignees{/user}","branches_url":"https://api.github.com/repos/edx/gradebook/branches{/branch}","tags_url":"https://api.github.com/repos/edx/gradebook/tags","blobs_url":"https://api.github.com/repos/edx/gradebook/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/gradebook/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/gradebook/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/gradebook/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/gradebook/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/gradebook/languages","stargazers_url":"https://api.github.com/repos/edx/gradebook/stargazers","contributors_url":"https://api.github.com/repos/edx/gradebook/contributors","subscribers_url":"https://api.github.com/repos/edx/gradebook/subscribers","subscription_url":"https://api.github.com/repos/edx/gradebook/subscription","commits_url":"https://api.github.com/repos/edx/gradebook/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/gradebook/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/gradebook/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/gradebook/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/gradebook/contents/{+path}","compare_url":"https://api.github.com/repos/edx/gradebook/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/gradebook/merges","archive_url":"https://api.github.com/repos/edx/gradebook/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/gradebook/downloads","issues_url":"https://api.github.com/repos/edx/gradebook/issues{/number}","pulls_url":"https://api.github.com/repos/edx/gradebook/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/gradebook/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/gradebook/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/gradebook/labels{/name}","releases_url":"https://api.github.com/repos/edx/gradebook/releases{/id}","deployments_url":"https://api.github.com/repos/edx/gradebook/deployments","created_at":"2018-10-17T15:49:15Z","updated_at":"2018-11-14T19:50:43Z","pushed_at":"2018-11-14T19:55:23Z","git_url":"git://github.com/edx/gradebook.git","ssh_url":"git@github.com:edx/gradebook.git","clone_url":"https://github.com/edx/gradebook.git","svn_url":"https://github.com/edx/gradebook","homepage":"","size":637,"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":0,"mirror_url":null,"archived":false,"open_issues_count":3,"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":0,"open_issues":3,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/gradebook/pulls/15"},"html":{"href":"https://github.com/edx/gradebook/pull/15"},"issue":{"href":"https://api.github.com/repos/edx/gradebook/issues/15"},"comments":{"href":"https://api.github.com/repos/edx/gradebook/issues/15/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/gradebook/pulls/15/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/gradebook/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/edx/gradebook/pulls/15/commits"},"statuses":{"href":"https://api.github.com/repos/edx/gradebook/statuses/5ff7a0945cdf6685ce07736faf51dd78d143d635"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"schenedx"}}