{"action":"created","comment":{"url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/pulls/comments/58620713","id":58620713,"diff_hunk":"@@ -46,12 +46,27 @@ class AllAnswers extends React.Component {\n      Common.initTinyMceContent('.answer');\n    }\n \n+   sortAnswers(answers_obj){\n+    let answers_arr = [], accepted_answer;\n+    for (var key in answers_obj) {\n+      answers_obj[key].accepted \n+      ? accepted_answer = answers_obj[key]\n+      : answers_arr.push(answers_obj[key]);\n+    }\n+    answers_arr = answers_arr.sort((current, next) => {\n+      return current.votes_count - next.votes_count;\n+    })\n+    answers_arr.push(accepted_answer);\n+    return answers_arr;\n+   }\n+\n    render () {\n      var answers = [], keys=[];\n-     if (!$.isEmptyObject(this.state.answers)) {\n-       keys = Object.keys(this.state.answers)\n+     let sorted_answers = this.sortAnswers(this.state.answers);\n+     if (!$.isEmptyObject(sorted_answers)) {","path":"app/js/components/answers/Index.react.js","position":41,"original_position":41,"commit_id":"2464f401ed5dc6f25a8cd3fb9af9a2feda3bb3c5","original_commit_id":"2464f401ed5dc6f25a8cd3fb9af9a2feda3bb3c5","user":{"login":"andela-iamadi","id":12391897,"avatar_url":"https://avatars.githubusercontent.com/u/12391897?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-iamadi","html_url":"https://github.com/andela-iamadi","followers_url":"https://api.github.com/users/andela-iamadi/followers","following_url":"https://api.github.com/users/andela-iamadi/following{/other_user}","gists_url":"https://api.github.com/users/andela-iamadi/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-iamadi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-iamadi/subscriptions","organizations_url":"https://api.github.com/users/andela-iamadi/orgs","repos_url":"https://api.github.com/users/andela-iamadi/repos","events_url":"https://api.github.com/users/andela-iamadi/events{/privacy}","received_events_url":"https://api.github.com/users/andela-iamadi/received_events","type":"User","site_admin":false},"body":"Let's pair on this later on. Sounds like an interesting concept.","created_at":"2016-04-05T21:58:55Z","updated_at":"2016-04-05T21:58:55Z","html_url":"https://github.com/andela-iamadi/Zhishi-Frontend/pull/7#discussion_r58620713","pull_request_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/pulls/7","_links":{"self":{"href":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/pulls/comments/58620713"},"html":{"href":"https://github.com/andela-iamadi/Zhishi-Frontend/pull/7#discussion_r58620713"},"pull_request":{"href":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/pulls/7","id":65073768,"html_url":"https://github.com/andela-iamadi/Zhishi-Frontend/pull/7","diff_url":"https://github.com/andela-iamadi/Zhishi-Frontend/pull/7.diff","patch_url":"https://github.com/andela-iamadi/Zhishi-Frontend/pull/7.patch","issue_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/issues/7","number":7,"state":"open","locked":false,"title":"Feat accept answer","user":{"login":"andela-cdaniel","id":7131935,"avatar_url":"https://avatars.githubusercontent.com/u/7131935?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-cdaniel","html_url":"https://github.com/andela-cdaniel","followers_url":"https://api.github.com/users/andela-cdaniel/followers","following_url":"https://api.github.com/users/andela-cdaniel/following{/other_user}","gists_url":"https://api.github.com/users/andela-cdaniel/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-cdaniel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-cdaniel/subscriptions","organizations_url":"https://api.github.com/users/andela-cdaniel/orgs","repos_url":"https://api.github.com/users/andela-cdaniel/repos","events_url":"https://api.github.com/users/andela-cdaniel/events{/privacy}","received_events_url":"https://api.github.com/users/andela-cdaniel/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-04-03T16:58:44Z","updated_at":"2016-04-05T21:58:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"51ccdfb4a16ef4b49f0f7f6c9c696b87ef25e090","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/pulls/7/commits","review_comments_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/pulls/7/comments","review_comment_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/issues/7/comments","statuses_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/statuses/2464f401ed5dc6f25a8cd3fb9af9a2feda3bb3c5","head":{"label":"andela-iamadi:feat-accept-answer","ref":"feat-accept-answer","sha":"2464f401ed5dc6f25a8cd3fb9af9a2feda3bb3c5","user":{"login":"andela-iamadi","id":12391897,"avatar_url":"https://avatars.githubusercontent.com/u/12391897?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-iamadi","html_url":"https://github.com/andela-iamadi","followers_url":"https://api.github.com/users/andela-iamadi/followers","following_url":"https://api.github.com/users/andela-iamadi/following{/other_user}","gists_url":"https://api.github.com/users/andela-iamadi/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-iamadi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-iamadi/subscriptions","organizations_url":"https://api.github.com/users/andela-iamadi/orgs","repos_url":"https://api.github.com/users/andela-iamadi/repos","events_url":"https://api.github.com/users/andela-iamadi/events{/privacy}","received_events_url":"https://api.github.com/users/andela-iamadi/received_events","type":"User","site_admin":false},"repo":{"id":49574148,"name":"Zhishi-Frontend","full_name":"andela-iamadi/Zhishi-Frontend","owner":{"login":"andela-iamadi","id":12391897,"avatar_url":"https://avatars.githubusercontent.com/u/12391897?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-iamadi","html_url":"https://github.com/andela-iamadi","followers_url":"https://api.github.com/users/andela-iamadi/followers","following_url":"https://api.github.com/users/andela-iamadi/following{/other_user}","gists_url":"https://api.github.com/users/andela-iamadi/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-iamadi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-iamadi/subscriptions","organizations_url":"https://api.github.com/users/andela-iamadi/orgs","repos_url":"https://api.github.com/users/andela-iamadi/repos","events_url":"https://api.github.com/users/andela-iamadi/events{/privacy}","received_events_url":"https://api.github.com/users/andela-iamadi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andela-iamadi/Zhishi-Frontend","description":"A Question and Answer platform for Andela fellows","fork":false,"url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend","forks_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/forks","keys_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/teams","hooks_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/hooks","issue_events_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/issues/events{/number}","events_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/events","assignees_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/assignees{/user}","branches_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/branches{/branch}","tags_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/tags","blobs_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/languages","stargazers_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/stargazers","contributors_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/contributors","subscribers_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/subscribers","subscription_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/subscription","commits_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/contents/{+path}","compare_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/merges","archive_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/downloads","issues_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/issues{/number}","pulls_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/labels{/name}","releases_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/releases{/id}","deployments_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/deployments","created_at":"2016-01-13T13:04:00Z","updated_at":"2016-01-24T16:07:42Z","pushed_at":"2016-04-03T17:20:46Z","git_url":"git://github.com/andela-iamadi/Zhishi-Frontend.git","ssh_url":"git@github.com:andela-iamadi/Zhishi-Frontend.git","clone_url":"https://github.com/andela-iamadi/Zhishi-Frontend.git","svn_url":"https://github.com/andela-iamadi/Zhishi-Frontend","homepage":null,"size":17839,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"andela-iamadi:master","ref":"master","sha":"6edce74ec2b394c68e2c7b9db4e0fd3221e8924a","user":{"login":"andela-iamadi","id":12391897,"avatar_url":"https://avatars.githubusercontent.com/u/12391897?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-iamadi","html_url":"https://github.com/andela-iamadi","followers_url":"https://api.github.com/users/andela-iamadi/followers","following_url":"https://api.github.com/users/andela-iamadi/following{/other_user}","gists_url":"https://api.github.com/users/andela-iamadi/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-iamadi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-iamadi/subscriptions","organizations_url":"https://api.github.com/users/andela-iamadi/orgs","repos_url":"https://api.github.com/users/andela-iamadi/repos","events_url":"https://api.github.com/users/andela-iamadi/events{/privacy}","received_events_url":"https://api.github.com/users/andela-iamadi/received_events","type":"User","site_admin":false},"repo":{"id":49574148,"name":"Zhishi-Frontend","full_name":"andela-iamadi/Zhishi-Frontend","owner":{"login":"andela-iamadi","id":12391897,"avatar_url":"https://avatars.githubusercontent.com/u/12391897?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-iamadi","html_url":"https://github.com/andela-iamadi","followers_url":"https://api.github.com/users/andela-iamadi/followers","following_url":"https://api.github.com/users/andela-iamadi/following{/other_user}","gists_url":"https://api.github.com/users/andela-iamadi/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-iamadi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-iamadi/subscriptions","organizations_url":"https://api.github.com/users/andela-iamadi/orgs","repos_url":"https://api.github.com/users/andela-iamadi/repos","events_url":"https://api.github.com/users/andela-iamadi/events{/privacy}","received_events_url":"https://api.github.com/users/andela-iamadi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andela-iamadi/Zhishi-Frontend","description":"A Question and Answer platform for Andela fellows","fork":false,"url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend","forks_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/forks","keys_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/teams","hooks_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/hooks","issue_events_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/issues/events{/number}","events_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/events","assignees_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/assignees{/user}","branches_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/branches{/branch}","tags_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/tags","blobs_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/languages","stargazers_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/stargazers","contributors_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/contributors","subscribers_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/subscribers","subscription_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/subscription","commits_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/contents/{+path}","compare_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/merges","archive_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/downloads","issues_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/issues{/number}","pulls_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/labels{/name}","releases_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/releases{/id}","deployments_url":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/deployments","created_at":"2016-01-13T13:04:00Z","updated_at":"2016-01-24T16:07:42Z","pushed_at":"2016-04-03T17:20:46Z","git_url":"git://github.com/andela-iamadi/Zhishi-Frontend.git","ssh_url":"git@github.com:andela-iamadi/Zhishi-Frontend.git","clone_url":"https://github.com/andela-iamadi/Zhishi-Frontend.git","svn_url":"https://github.com/andela-iamadi/Zhishi-Frontend","homepage":null,"size":17839,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/pulls/7"},"html":{"href":"https://github.com/andela-iamadi/Zhishi-Frontend/pull/7"},"issue":{"href":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/issues/7"},"comments":{"href":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/andela-iamadi/Zhishi-Frontend/statuses/2464f401ed5dc6f25a8cd3fb9af9a2feda3bb3c5"}}}}