{"action":"created","comment":{"url":"https://api.github.com/repos/adesege/HelloBooks/pulls/comments/154543524","pull_request_review_id":80720570,"id":154543524,"diff_hunk":"@@ -24,44 +19,47 @@ export default (state = initialState, action = {}) => {\n     };\n \n   case BOOK_ADDED:\n-    return [\n-      action.book,\n-      ...state\n-    ];\n+    return {\n+      books: [\n+        action.book,\n+        ...state.books\n+      ],\n+      pagination: {\n+        ...state.pagination\n+      }\n+    };\n \n   case BOOKS_SEARCHED:\n     return action.result;\n \n-  case BOOK_FETCHED:\n-    const index = findIndex(state, item => item.id === action.book.id);\n-    if (index > -1) {\n-      return state.map((item) => {\n-        if (item.id === action.book.id) return action.book;\n-        return item;\n-      });\n-    }\n-    return action.book;\n-\n   case BOOK_UPDATED:\n-    const idIndex = findIndex(state, item => item.id === action.book.id);\n-    if (idIndex > -1) {\n-      return state.map((item) => {\n-        if (item.id === action.book.id) return action.book;\n-        return item;\n-      });\n+    const book = state.books.map((item) => {\n+      if (parseInt(item.id, 10) === parseInt(action.book.id, 10)) {\n+        return action.book;\n+      }\n+      return {};\n+    });\n+    if (Object.keys(book[0]).length !== 0) {\n+      return {\n+        books: book,\n+        pagination: { ...state.pagination }\n+      };\n     }\n-    return action.book;\n+    return state;\n \n   case BOOK_DELETED:\n     const findBook = findIndex(\n-      state,\n+      state.books,\n       item => parseInt(item.id, 10) === parseInt(action.bookId, 10)\n     );\n-    if (findBook >= 0) {\n-      return [\n-        ...state.slice(0, findBook),\n-        ...state.slice(findBook + 1),\n-      ];\n+    if (findBook > -1) {\n+      return {\n+        books: [\n+          ...state.books.slice(0, findBook),\n+          ...state.books.slice(findBook + 1),\n+        ],\n+        pagination: { ...state.pagination }\n+      };","path":"client/src/reducers/books.js","position":95,"original_position":95,"commit_id":"62ba4bd51169906cf179c077706ebc82f9f461ef","original_commit_id":"62ba4bd51169906cf179c077706ebc82f9f461ef","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars0.githubusercontent.com/u/6697940?v=4","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"Expected indentation of 8 spaces but found 6         indent","created_at":"2017-12-04T00:41:51Z","updated_at":"2017-12-04T00:41:51Z","html_url":"https://github.com/adesege/HelloBooks/pull/76#discussion_r154543524","pull_request_url":"https://api.github.com/repos/adesege/HelloBooks/pulls/76","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/adesege/HelloBooks/pulls/comments/154543524"},"html":{"href":"https://github.com/adesege/HelloBooks/pull/76#discussion_r154543524"},"pull_request":{"href":"https://api.github.com/repos/adesege/HelloBooks/pulls/76"}}},"pull_request":{"url":"https://api.github.com/repos/adesege/HelloBooks/pulls/76","id":156089183,"html_url":"https://github.com/adesege/HelloBooks/pull/76","diff_url":"https://github.com/adesege/HelloBooks/pull/76.diff","patch_url":"https://github.com/adesege/HelloBooks/pull/76.patch","issue_url":"https://api.github.com/repos/adesege/HelloBooks/issues/76","number":76,"state":"open","locked":false,"title":"chore(client-test): setup client side testing","user":{"login":"adesege","id":20769821,"avatar_url":"https://avatars3.githubusercontent.com/u/20769821?v=4","gravatar_id":"","url":"https://api.github.com/users/adesege","html_url":"https://github.com/adesege","followers_url":"https://api.github.com/users/adesege/followers","following_url":"https://api.github.com/users/adesege/following{/other_user}","gists_url":"https://api.github.com/users/adesege/gists{/gist_id}","starred_url":"https://api.github.com/users/adesege/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adesege/subscriptions","organizations_url":"https://api.github.com/users/adesege/orgs","repos_url":"https://api.github.com/users/adesege/repos","events_url":"https://api.github.com/users/adesege/events{/privacy}","received_events_url":"https://api.github.com/users/adesege/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-12-04T00:00:54Z","updated_at":"2017-12-04T00:41:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0e33e241c403e4cb9583d5a0792bce29bc485d7a","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/adesege/HelloBooks/pulls/76/commits","review_comments_url":"https://api.github.com/repos/adesege/HelloBooks/pulls/76/comments","review_comment_url":"https://api.github.com/repos/adesege/HelloBooks/pulls/comments{/number}","comments_url":"https://api.github.com/repos/adesege/HelloBooks/issues/76/comments","statuses_url":"https://api.github.com/repos/adesege/HelloBooks/statuses/62ba4bd51169906cf179c077706ebc82f9f461ef","head":{"label":"adesege:chore/153002901/setup-client-testing","ref":"chore/153002901/setup-client-testing","sha":"62ba4bd51169906cf179c077706ebc82f9f461ef","user":{"login":"adesege","id":20769821,"avatar_url":"https://avatars3.githubusercontent.com/u/20769821?v=4","gravatar_id":"","url":"https://api.github.com/users/adesege","html_url":"https://github.com/adesege","followers_url":"https://api.github.com/users/adesege/followers","following_url":"https://api.github.com/users/adesege/following{/other_user}","gists_url":"https://api.github.com/users/adesege/gists{/gist_id}","starred_url":"https://api.github.com/users/adesege/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adesege/subscriptions","organizations_url":"https://api.github.com/users/adesege/orgs","repos_url":"https://api.github.com/users/adesege/repos","events_url":"https://api.github.com/users/adesege/events{/privacy}","received_events_url":"https://api.github.com/users/adesege/received_events","type":"User","site_admin":false},"repo":{"id":98338255,"name":"HelloBooks","full_name":"adesege/HelloBooks","owner":{"login":"adesege","id":20769821,"avatar_url":"https://avatars3.githubusercontent.com/u/20769821?v=4","gravatar_id":"","url":"https://api.github.com/users/adesege","html_url":"https://github.com/adesege","followers_url":"https://api.github.com/users/adesege/followers","following_url":"https://api.github.com/users/adesege/following{/other_user}","gists_url":"https://api.github.com/users/adesege/gists{/gist_id}","starred_url":"https://api.github.com/users/adesege/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adesege/subscriptions","organizations_url":"https://api.github.com/users/adesege/orgs","repos_url":"https://api.github.com/users/adesege/repos","events_url":"https://api.github.com/users/adesege/events{/privacy}","received_events_url":"https://api.github.com/users/adesege/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/adesege/HelloBooks","description":"A simple application that helps manage a library and its processes like stocking, tracking and renting books","fork":false,"url":"https://api.github.com/repos/adesege/HelloBooks","forks_url":"https://api.github.com/repos/adesege/HelloBooks/forks","keys_url":"https://api.github.com/repos/adesege/HelloBooks/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adesege/HelloBooks/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adesege/HelloBooks/teams","hooks_url":"https://api.github.com/repos/adesege/HelloBooks/hooks","issue_events_url":"https://api.github.com/repos/adesege/HelloBooks/issues/events{/number}","events_url":"https://api.github.com/repos/adesege/HelloBooks/events","assignees_url":"https://api.github.com/repos/adesege/HelloBooks/assignees{/user}","branches_url":"https://api.github.com/repos/adesege/HelloBooks/branches{/branch}","tags_url":"https://api.github.com/repos/adesege/HelloBooks/tags","blobs_url":"https://api.github.com/repos/adesege/HelloBooks/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adesege/HelloBooks/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adesege/HelloBooks/git/refs{/sha}","trees_url":"https://api.github.com/repos/adesege/HelloBooks/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adesege/HelloBooks/statuses/{sha}","languages_url":"https://api.github.com/repos/adesege/HelloBooks/languages","stargazers_url":"https://api.github.com/repos/adesege/HelloBooks/stargazers","contributors_url":"https://api.github.com/repos/adesege/HelloBooks/contributors","subscribers_url":"https://api.github.com/repos/adesege/HelloBooks/subscribers","subscription_url":"https://api.github.com/repos/adesege/HelloBooks/subscription","commits_url":"https://api.github.com/repos/adesege/HelloBooks/commits{/sha}","git_commits_url":"https://api.github.com/repos/adesege/HelloBooks/git/commits{/sha}","comments_url":"https://api.github.com/repos/adesege/HelloBooks/comments{/number}","issue_comment_url":"https://api.github.com/repos/adesege/HelloBooks/issues/comments{/number}","contents_url":"https://api.github.com/repos/adesege/HelloBooks/contents/{+path}","compare_url":"https://api.github.com/repos/adesege/HelloBooks/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adesege/HelloBooks/merges","archive_url":"https://api.github.com/repos/adesege/HelloBooks/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adesege/HelloBooks/downloads","issues_url":"https://api.github.com/repos/adesege/HelloBooks/issues{/number}","pulls_url":"https://api.github.com/repos/adesege/HelloBooks/pulls{/number}","milestones_url":"https://api.github.com/repos/adesege/HelloBooks/milestones{/number}","notifications_url":"https://api.github.com/repos/adesege/HelloBooks/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adesege/HelloBooks/labels{/name}","releases_url":"https://api.github.com/repos/adesege/HelloBooks/releases{/id}","deployments_url":"https://api.github.com/repos/adesege/HelloBooks/deployments","created_at":"2017-07-25T18:35:25Z","updated_at":"2017-11-17T15:36:10Z","pushed_at":"2017-12-04T00:41:12Z","git_url":"git://github.com/adesege/HelloBooks.git","ssh_url":"git@github.com:adesege/HelloBooks.git","clone_url":"https://github.com/adesege/HelloBooks.git","svn_url":"https://github.com/adesege/HelloBooks","homepage":"http://hellobooks.herokuapp.com","size":13928,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":2,"open_issues":1,"watchers":0,"default_branch":"development"}},"base":{"label":"adesege:development","ref":"development","sha":"18f1ac93464523b66993c5859a22633a80bdcdee","user":{"login":"adesege","id":20769821,"avatar_url":"https://avatars3.githubusercontent.com/u/20769821?v=4","gravatar_id":"","url":"https://api.github.com/users/adesege","html_url":"https://github.com/adesege","followers_url":"https://api.github.com/users/adesege/followers","following_url":"https://api.github.com/users/adesege/following{/other_user}","gists_url":"https://api.github.com/users/adesege/gists{/gist_id}","starred_url":"https://api.github.com/users/adesege/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adesege/subscriptions","organizations_url":"https://api.github.com/users/adesege/orgs","repos_url":"https://api.github.com/users/adesege/repos","events_url":"https://api.github.com/users/adesege/events{/privacy}","received_events_url":"https://api.github.com/users/adesege/received_events","type":"User","site_admin":false},"repo":{"id":98338255,"name":"HelloBooks","full_name":"adesege/HelloBooks","owner":{"login":"adesege","id":20769821,"avatar_url":"https://avatars3.githubusercontent.com/u/20769821?v=4","gravatar_id":"","url":"https://api.github.com/users/adesege","html_url":"https://github.com/adesege","followers_url":"https://api.github.com/users/adesege/followers","following_url":"https://api.github.com/users/adesege/following{/other_user}","gists_url":"https://api.github.com/users/adesege/gists{/gist_id}","starred_url":"https://api.github.com/users/adesege/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adesege/subscriptions","organizations_url":"https://api.github.com/users/adesege/orgs","repos_url":"https://api.github.com/users/adesege/repos","events_url":"https://api.github.com/users/adesege/events{/privacy}","received_events_url":"https://api.github.com/users/adesege/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/adesege/HelloBooks","description":"A simple application that helps manage a library and its processes like stocking, tracking and renting books","fork":false,"url":"https://api.github.com/repos/adesege/HelloBooks","forks_url":"https://api.github.com/repos/adesege/HelloBooks/forks","keys_url":"https://api.github.com/repos/adesege/HelloBooks/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adesege/HelloBooks/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adesege/HelloBooks/teams","hooks_url":"https://api.github.com/repos/adesege/HelloBooks/hooks","issue_events_url":"https://api.github.com/repos/adesege/HelloBooks/issues/events{/number}","events_url":"https://api.github.com/repos/adesege/HelloBooks/events","assignees_url":"https://api.github.com/repos/adesege/HelloBooks/assignees{/user}","branches_url":"https://api.github.com/repos/adesege/HelloBooks/branches{/branch}","tags_url":"https://api.github.com/repos/adesege/HelloBooks/tags","blobs_url":"https://api.github.com/repos/adesege/HelloBooks/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adesege/HelloBooks/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adesege/HelloBooks/git/refs{/sha}","trees_url":"https://api.github.com/repos/adesege/HelloBooks/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adesege/HelloBooks/statuses/{sha}","languages_url":"https://api.github.com/repos/adesege/HelloBooks/languages","stargazers_url":"https://api.github.com/repos/adesege/HelloBooks/stargazers","contributors_url":"https://api.github.com/repos/adesege/HelloBooks/contributors","subscribers_url":"https://api.github.com/repos/adesege/HelloBooks/subscribers","subscription_url":"https://api.github.com/repos/adesege/HelloBooks/subscription","commits_url":"https://api.github.com/repos/adesege/HelloBooks/commits{/sha}","git_commits_url":"https://api.github.com/repos/adesege/HelloBooks/git/commits{/sha}","comments_url":"https://api.github.com/repos/adesege/HelloBooks/comments{/number}","issue_comment_url":"https://api.github.com/repos/adesege/HelloBooks/issues/comments{/number}","contents_url":"https://api.github.com/repos/adesege/HelloBooks/contents/{+path}","compare_url":"https://api.github.com/repos/adesege/HelloBooks/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adesege/HelloBooks/merges","archive_url":"https://api.github.com/repos/adesege/HelloBooks/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adesege/HelloBooks/downloads","issues_url":"https://api.github.com/repos/adesege/HelloBooks/issues{/number}","pulls_url":"https://api.github.com/repos/adesege/HelloBooks/pulls{/number}","milestones_url":"https://api.github.com/repos/adesege/HelloBooks/milestones{/number}","notifications_url":"https://api.github.com/repos/adesege/HelloBooks/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adesege/HelloBooks/labels{/name}","releases_url":"https://api.github.com/repos/adesege/HelloBooks/releases{/id}","deployments_url":"https://api.github.com/repos/adesege/HelloBooks/deployments","created_at":"2017-07-25T18:35:25Z","updated_at":"2017-11-17T15:36:10Z","pushed_at":"2017-12-04T00:41:12Z","git_url":"git://github.com/adesege/HelloBooks.git","ssh_url":"git@github.com:adesege/HelloBooks.git","clone_url":"https://github.com/adesege/HelloBooks.git","svn_url":"https://github.com/adesege/HelloBooks","homepage":"http://hellobooks.herokuapp.com","size":13928,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":2,"open_issues":1,"watchers":0,"default_branch":"development"}},"_links":{"self":{"href":"https://api.github.com/repos/adesege/HelloBooks/pulls/76"},"html":{"href":"https://github.com/adesege/HelloBooks/pull/76"},"issue":{"href":"https://api.github.com/repos/adesege/HelloBooks/issues/76"},"comments":{"href":"https://api.github.com/repos/adesege/HelloBooks/issues/76/comments"},"review_comments":{"href":"https://api.github.com/repos/adesege/HelloBooks/pulls/76/comments"},"review_comment":{"href":"https://api.github.com/repos/adesege/HelloBooks/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/adesege/HelloBooks/pulls/76/commits"},"statuses":{"href":"https://api.github.com/repos/adesege/HelloBooks/statuses/62ba4bd51169906cf179c077706ebc82f9f461ef"}},"author_association":"OWNER"}}
{"actor":{"display_login":"houndci-bot"}}