{"action":"created","comment":{"url":"https://api.github.com/repos/unee-t/frontend/pulls/comments/227199707","pull_request_review_id":166853563,"id":227199707,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNzE5OTcwNw==","diff_hunk":"@@ -0,0 +1,52 @@\n+export const SORT_BY = {\n+  DATE_DESCENDING: 0,\n+  DATE_ASCENDING: 1,\n+  NAME_ASCENDING: 2,\n+  NAME_DESCENDING: 3,\n+  LATEST_UPDATE: 4,\n+  OLDEST_UPDATE: 5\n+}\n+\n+export const labels = [\n+  [SORT_BY.DATE_DESCENDING, {category: 'Created - Latest', selected: 'Created ↓'}],\n+  [SORT_BY.DATE_ASCENDING, {category: 'Created - Oldest', selected: ' Created ↑'}],\n+  [SORT_BY.NAME_ASCENDING, {category: 'Name (A to Z)', selected: 'Name ↑'}],\n+  [SORT_BY.NAME_DESCENDING, {category: 'Name (Z to A)', selected: 'Name ↓'}]\n+]\n+\n+export const sorters = {\n+  [SORT_BY.DATE_DESCENDING]: (a, b) => {\n+    const latestCaseAunit = a.items && a.items[0].creation_time\n+    const latestCaseBunit = b.items && b.items[0].creation_time\n+    const dateA = Date.parse(latestCaseAunit && latestCaseAunit) || Date.parse(a.creation_time)\n+    const dateB = Date.parse(latestCaseBunit && latestCaseBunit) || Date.parse(b.creation_time)\n+    return dateB - dateA\n+  },\n+  [SORT_BY.DATE_ASCENDING]: (a, b) => {\n+    const oldestCaseAunit = a.items && a.items[0].creation_time\n+    const oldestCaseBunit = b.items && b.items[0].creation_time\n+    const dateA = Date.parse(oldestCaseAunit && oldestCaseAunit) || Date.parse(a.creation_time)\n+    const dateB = Date.parse(oldestCaseBunit && oldestCaseBunit) || Date.parse(b.creation_time)\n+    return dateA - dateB\n+  },\n+  [SORT_BY.NAME_ASCENDING]: (a, b) => {\n+    const nameA = a.unitTitle || a.title || a.name","path":"imports/ui/explorer-components/sort-items.js","position":33,"original_position":33,"commit_id":"70f1eddd279110abf64e8ca9f00252ee262ecdfa","original_commit_id":"70f1eddd279110abf64e8ca9f00252ee262ecdfa","user":{"login":"nbiton","id":2662819,"node_id":"MDQ6VXNlcjI2NjI4MTk=","avatar_url":"https://avatars1.githubusercontent.com/u/2662819?v=4","gravatar_id":"","url":"https://api.github.com/users/nbiton","html_url":"https://github.com/nbiton","followers_url":"https://api.github.com/users/nbiton/followers","following_url":"https://api.github.com/users/nbiton/following{/other_user}","gists_url":"https://api.github.com/users/nbiton/gists{/gist_id}","starred_url":"https://api.github.com/users/nbiton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nbiton/subscriptions","organizations_url":"https://api.github.com/users/nbiton/orgs","repos_url":"https://api.github.com/users/nbiton/repos","events_url":"https://api.github.com/users/nbiton/events{/privacy}","received_events_url":"https://api.github.com/users/nbiton/received_events","type":"User","site_admin":false},"body":"I don't like that there are specific item attributes here. It should be more generic. Since it'll be slightly harder to refactor quickly. Let's just leave it as is for now","created_at":"2018-10-23T02:15:32Z","updated_at":"2018-10-23T02:29:01Z","html_url":"https://github.com/unee-t/frontend/pull/565#discussion_r227199707","pull_request_url":"https://api.github.com/repos/unee-t/frontend/pulls/565","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/unee-t/frontend/pulls/comments/227199707"},"html":{"href":"https://github.com/unee-t/frontend/pull/565#discussion_r227199707"},"pull_request":{"href":"https://api.github.com/repos/unee-t/frontend/pulls/565"}}},"pull_request":{"url":"https://api.github.com/repos/unee-t/frontend/pulls/565","id":219977157,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE5OTc3MTU3","html_url":"https://github.com/unee-t/frontend/pull/565","diff_url":"https://github.com/unee-t/frontend/pull/565.diff","patch_url":"https://github.com/unee-t/frontend/pull/565.patch","issue_url":"https://api.github.com/repos/unee-t/frontend/issues/565","number":565,"state":"open","locked":false,"title":"feat: sorter & filter in case, report explorer","user":{"login":"sophieyang0813","id":25441733,"node_id":"MDQ6VXNlcjI1NDQxNzMz","avatar_url":"https://avatars1.githubusercontent.com/u/25441733?v=4","gravatar_id":"","url":"https://api.github.com/users/sophieyang0813","html_url":"https://github.com/sophieyang0813","followers_url":"https://api.github.com/users/sophieyang0813/followers","following_url":"https://api.github.com/users/sophieyang0813/following{/other_user}","gists_url":"https://api.github.com/users/sophieyang0813/gists{/gist_id}","starred_url":"https://api.github.com/users/sophieyang0813/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sophieyang0813/subscriptions","organizations_url":"https://api.github.com/users/sophieyang0813/orgs","repos_url":"https://api.github.com/users/sophieyang0813/repos","events_url":"https://api.github.com/users/sophieyang0813/events{/privacy}","received_events_url":"https://api.github.com/users/sophieyang0813/received_events","type":"User","site_admin":false},"body":"fixes #496 \r\n* filter, sorter in 1) the case view of unit page,  2) case-explorer, 3) report-explorer \r\n* I think I can refactor furthermore","created_at":"2018-10-03T09:54:06Z","updated_at":"2018-10-23T02:29:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b930916c4010cb75c14082688584144510da1024","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/unee-t/frontend/pulls/565/commits","review_comments_url":"https://api.github.com/repos/unee-t/frontend/pulls/565/comments","review_comment_url":"https://api.github.com/repos/unee-t/frontend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/unee-t/frontend/issues/565/comments","statuses_url":"https://api.github.com/repos/unee-t/frontend/statuses/70f1eddd279110abf64e8ca9f00252ee262ecdfa","head":{"label":"sophieyang0813:standard-filter","ref":"standard-filter","sha":"70f1eddd279110abf64e8ca9f00252ee262ecdfa","user":{"login":"sophieyang0813","id":25441733,"node_id":"MDQ6VXNlcjI1NDQxNzMz","avatar_url":"https://avatars1.githubusercontent.com/u/25441733?v=4","gravatar_id":"","url":"https://api.github.com/users/sophieyang0813","html_url":"https://github.com/sophieyang0813","followers_url":"https://api.github.com/users/sophieyang0813/followers","following_url":"https://api.github.com/users/sophieyang0813/following{/other_user}","gists_url":"https://api.github.com/users/sophieyang0813/gists{/gist_id}","starred_url":"https://api.github.com/users/sophieyang0813/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sophieyang0813/subscriptions","organizations_url":"https://api.github.com/users/sophieyang0813/orgs","repos_url":"https://api.github.com/users/sophieyang0813/repos","events_url":"https://api.github.com/users/sophieyang0813/events{/privacy}","received_events_url":"https://api.github.com/users/sophieyang0813/received_events","type":"User","site_admin":false},"repo":{"id":133610092,"node_id":"MDEwOlJlcG9zaXRvcnkxMzM2MTAwOTI=","name":"frontend","full_name":"sophieyang0813/frontend","private":false,"owner":{"login":"sophieyang0813","id":25441733,"node_id":"MDQ6VXNlcjI1NDQxNzMz","avatar_url":"https://avatars1.githubusercontent.com/u/25441733?v=4","gravatar_id":"","url":"https://api.github.com/users/sophieyang0813","html_url":"https://github.com/sophieyang0813","followers_url":"https://api.github.com/users/sophieyang0813/followers","following_url":"https://api.github.com/users/sophieyang0813/following{/other_user}","gists_url":"https://api.github.com/users/sophieyang0813/gists{/gist_id}","starred_url":"https://api.github.com/users/sophieyang0813/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sophieyang0813/subscriptions","organizations_url":"https://api.github.com/users/sophieyang0813/orgs","repos_url":"https://api.github.com/users/sophieyang0813/repos","events_url":"https://api.github.com/users/sophieyang0813/events{/privacy}","received_events_url":"https://api.github.com/users/sophieyang0813/received_events","type":"User","site_admin":false},"html_url":"https://github.com/sophieyang0813/frontend","description":"Meteor front end","fork":true,"url":"https://api.github.com/repos/sophieyang0813/frontend","forks_url":"https://api.github.com/repos/sophieyang0813/frontend/forks","keys_url":"https://api.github.com/repos/sophieyang0813/frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sophieyang0813/frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sophieyang0813/frontend/teams","hooks_url":"https://api.github.com/repos/sophieyang0813/frontend/hooks","issue_events_url":"https://api.github.com/repos/sophieyang0813/frontend/issues/events{/number}","events_url":"https://api.github.com/repos/sophieyang0813/frontend/events","assignees_url":"https://api.github.com/repos/sophieyang0813/frontend/assignees{/user}","branches_url":"https://api.github.com/repos/sophieyang0813/frontend/branches{/branch}","tags_url":"https://api.github.com/repos/sophieyang0813/frontend/tags","blobs_url":"https://api.github.com/repos/sophieyang0813/frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sophieyang0813/frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sophieyang0813/frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/sophieyang0813/frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sophieyang0813/frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/sophieyang0813/frontend/languages","stargazers_url":"https://api.github.com/repos/sophieyang0813/frontend/stargazers","contributors_url":"https://api.github.com/repos/sophieyang0813/frontend/contributors","subscribers_url":"https://api.github.com/repos/sophieyang0813/frontend/subscribers","subscription_url":"https://api.github.com/repos/sophieyang0813/frontend/subscription","commits_url":"https://api.github.com/repos/sophieyang0813/frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/sophieyang0813/frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/sophieyang0813/frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/sophieyang0813/frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/sophieyang0813/frontend/contents/{+path}","compare_url":"https://api.github.com/repos/sophieyang0813/frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sophieyang0813/frontend/merges","archive_url":"https://api.github.com/repos/sophieyang0813/frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sophieyang0813/frontend/downloads","issues_url":"https://api.github.com/repos/sophieyang0813/frontend/issues{/number}","pulls_url":"https://api.github.com/repos/sophieyang0813/frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/sophieyang0813/frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/sophieyang0813/frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sophieyang0813/frontend/labels{/name}","releases_url":"https://api.github.com/repos/sophieyang0813/frontend/releases{/id}","deployments_url":"https://api.github.com/repos/sophieyang0813/frontend/deployments","created_at":"2018-05-16T04:24:04Z","updated_at":"2018-07-13T03:29:33Z","pushed_at":"2018-10-22T06:23:44Z","git_url":"git://github.com/sophieyang0813/frontend.git","ssh_url":"git@github.com:sophieyang0813/frontend.git","clone_url":"https://github.com/sophieyang0813/frontend.git","svn_url":"https://github.com/sophieyang0813/frontend","homepage":"https://case.dev.unee-t.com/","size":8396,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"unee-t:master","ref":"master","sha":"2da539be0cbbb9005dcf83784214312503c9f880","user":{"login":"unee-t","id":31331439,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMxMzMxNDM5","avatar_url":"https://avatars0.githubusercontent.com/u/31331439?v=4","gravatar_id":"","url":"https://api.github.com/users/unee-t","html_url":"https://github.com/unee-t","followers_url":"https://api.github.com/users/unee-t/followers","following_url":"https://api.github.com/users/unee-t/following{/other_user}","gists_url":"https://api.github.com/users/unee-t/gists{/gist_id}","starred_url":"https://api.github.com/users/unee-t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unee-t/subscriptions","organizations_url":"https://api.github.com/users/unee-t/orgs","repos_url":"https://api.github.com/users/unee-t/repos","events_url":"https://api.github.com/users/unee-t/events{/privacy}","received_events_url":"https://api.github.com/users/unee-t/received_events","type":"Organization","site_admin":false},"repo":{"id":101357388,"node_id":"MDEwOlJlcG9zaXRvcnkxMDEzNTczODg=","name":"frontend","full_name":"unee-t/frontend","private":false,"owner":{"login":"unee-t","id":31331439,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMxMzMxNDM5","avatar_url":"https://avatars0.githubusercontent.com/u/31331439?v=4","gravatar_id":"","url":"https://api.github.com/users/unee-t","html_url":"https://github.com/unee-t","followers_url":"https://api.github.com/users/unee-t/followers","following_url":"https://api.github.com/users/unee-t/following{/other_user}","gists_url":"https://api.github.com/users/unee-t/gists{/gist_id}","starred_url":"https://api.github.com/users/unee-t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unee-t/subscriptions","organizations_url":"https://api.github.com/users/unee-t/orgs","repos_url":"https://api.github.com/users/unee-t/repos","events_url":"https://api.github.com/users/unee-t/events{/privacy}","received_events_url":"https://api.github.com/users/unee-t/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/unee-t/frontend","description":"Meteor front end","fork":false,"url":"https://api.github.com/repos/unee-t/frontend","forks_url":"https://api.github.com/repos/unee-t/frontend/forks","keys_url":"https://api.github.com/repos/unee-t/frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/unee-t/frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/unee-t/frontend/teams","hooks_url":"https://api.github.com/repos/unee-t/frontend/hooks","issue_events_url":"https://api.github.com/repos/unee-t/frontend/issues/events{/number}","events_url":"https://api.github.com/repos/unee-t/frontend/events","assignees_url":"https://api.github.com/repos/unee-t/frontend/assignees{/user}","branches_url":"https://api.github.com/repos/unee-t/frontend/branches{/branch}","tags_url":"https://api.github.com/repos/unee-t/frontend/tags","blobs_url":"https://api.github.com/repos/unee-t/frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/unee-t/frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/unee-t/frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/unee-t/frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/unee-t/frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/unee-t/frontend/languages","stargazers_url":"https://api.github.com/repos/unee-t/frontend/stargazers","contributors_url":"https://api.github.com/repos/unee-t/frontend/contributors","subscribers_url":"https://api.github.com/repos/unee-t/frontend/subscribers","subscription_url":"https://api.github.com/repos/unee-t/frontend/subscription","commits_url":"https://api.github.com/repos/unee-t/frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/unee-t/frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/unee-t/frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/unee-t/frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/unee-t/frontend/contents/{+path}","compare_url":"https://api.github.com/repos/unee-t/frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/unee-t/frontend/merges","archive_url":"https://api.github.com/repos/unee-t/frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/unee-t/frontend/downloads","issues_url":"https://api.github.com/repos/unee-t/frontend/issues{/number}","pulls_url":"https://api.github.com/repos/unee-t/frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/unee-t/frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/unee-t/frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/unee-t/frontend/labels{/name}","releases_url":"https://api.github.com/repos/unee-t/frontend/releases{/id}","deployments_url":"https://api.github.com/repos/unee-t/frontend/deployments","created_at":"2017-08-25T02:29:52Z","updated_at":"2018-10-22T07:22:30Z","pushed_at":"2018-10-23T02:05:58Z","git_url":"git://github.com/unee-t/frontend.git","ssh_url":"git@github.com:unee-t/frontend.git","clone_url":"https://github.com/unee-t/frontend.git","svn_url":"https://github.com/unee-t/frontend","homepage":"https://case.dev.unee-t.com/","size":4006,"stargazers_count":5,"watchers_count":5,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"archived":false,"open_issues_count":143,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":13,"open_issues":143,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/unee-t/frontend/pulls/565"},"html":{"href":"https://github.com/unee-t/frontend/pull/565"},"issue":{"href":"https://api.github.com/repos/unee-t/frontend/issues/565"},"comments":{"href":"https://api.github.com/repos/unee-t/frontend/issues/565/comments"},"review_comments":{"href":"https://api.github.com/repos/unee-t/frontend/pulls/565/comments"},"review_comment":{"href":"https://api.github.com/repos/unee-t/frontend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/unee-t/frontend/pulls/565/commits"},"statuses":{"href":"https://api.github.com/repos/unee-t/frontend/statuses/70f1eddd279110abf64e8ca9f00252ee262ecdfa"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"nbiton"}}