{"action":"created","comment":{"url":"https://api.github.com/repos/conniey/intern-project/pulls/comments/311668573","pull_request_review_id":272106562,"id":311668573,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDMxMTY2ODU3Mw==","diff_hunk":"@@ -209,72 +277,75 @@ private static void showMenu() {\n                 System.out.printf(\"Here are books %s %s. Please enter the number you wish to view.\"\n                     + \" (Enter \\\"Q\\\" to return to menu.)\\n\", option.contentEquals(\"title\") ? \"titled\"\n                     : \"by\", input);\n-                for (int i = 0; i < list.size(); i++) {\n-                    Book book1 = list.get(i);\n-                    System.out.println(i + 1 + \". \" + book1);\n-                }\n-                int choice;\n-                do {\n-                    String observe = SCANNER.nextLine();\n-                    choice = OPTION_CHECKER.checkOption(observe, list.size());\n-                } while (choice == INVALID);\n+                int choice = getBook(list);\n                 int bookNum = choice - 1;\n                 if (choice != 0) {\n                     return bookCollector.grabCoverImage(list.get(bookNum)).map(cover ->\n                         list.get(bookNum).displayBookInfo(cover)\n                     );\n                 }\n             }\n-            return Mono.just(\"\\n\");\n+            return Mono.just(\"\");\n         });\n     }\n \n     private static Mono<String> deleteBook() {\n-        System.out.println(\"Enter the title of the book to delete: \");\n+        return grabBook(\"delete\").flatMap(book -> {\n+            if (book.getTitle() == null) {\n+                return Mono.just(\"\");\n+            }\n+            return bookCollector.deleteBook(book).\n+                then(Mono.just(\"Book was deleted.\"))\n+                .onErrorResume(error -> Mono.just(\"Error. Book wasn't deleted.\"));\n+        });\n+    }\n+\n+    private static Mono<Book> grabBook(String modifier) {\n+        System.out.printf(\"Please enter the title of the book %s: \", modifier.contentEquals(\"delete\")\n+            ? \"to delete\" : \"to edit\");\n         Flux<Book> booksToDelete = bookCollector.findBook(SCANNER.nextLine());\n-        return booksToDelete.collectList().flatMap(list -> {\n+        return booksToDelete.collectList().map(list -> {\n             if (list.isEmpty()) {\n                 System.out.println(\"There are no books with that title.\");\n-                return Mono.just(\"\");\n+                return new Book(null, null, null);\n             }\n             if (list.size() == 1) {\n                 System.out.println(\"Here is a matching book.\");\n                 System.out.println(\" * \" + list.get(0));\n-                System.out.print(\"Would you like to delete it? \");\n+                System.out.printf(\"Would you like to %s it? \", modifier.contentEquals(\"delete\")\n+                    ? \"delete\" : \"edit\");\n                 String choice = getYesOrNo();\n                 if (choice.equalsIgnoreCase(\"Y\")) {\n-                    return deleteBookHelper(list.get(0));\n+                    return list.get(0);\n                 }\n             } else {\n-                System.out.println(\"Here are matching books. Enter the number to delete :  (Enter \\\"Q\\\" to return to menu.) \");\n-                for (int i = 0; i < list.size(); i++) {\n-                    System.out.println(i + 1 + \". \" + list.get(i));\n-                }\n-                int choice;\n-                do {\n-                    String option = SCANNER.nextLine();\n-                    choice = OPTION_CHECKER.checkOption(option, list.size());\n-                } while (choice == INVALID);\n-                if (choice != 0) {\n-                    System.out.println(\"Delete \\\"\" + list.get(choice - 1) + \"\\\"? \");\n-                    String delete = getYesOrNo();\n+                System.out.printf(\"Here are matching books. Enter the number to %s :  (Enter \\\"Q\\\" to return to menu.) \",\n+                    modifier.contentEquals(\"delete\") ? \"to delete\" : \"to edit\");\n+                int choice = getBook(list);\n+                if (choice != 0 && modifier.contentEquals(\"delete\")) {\n+                    System.out.println(\"Delete \\\"\" + list.get(choice - 1) + \"\\\"? Enter Y or N.\");\n+                    String delete = SCANNER.nextLine();\n                     if (delete.equalsIgnoreCase(\"y\")) {\n-                        return deleteBookHelper(list.get(choice - 1));\n+                        return list.get(choice - 1);\n                     }\n+                } else if (modifier.contentEquals(\"edit\")) {\n+                    return list.get(choice - 1);\n                 }\n             }\n-            return Mono.just(\"\");\n+            return new Book(null, null, null);","path":"src/main/java/com/azure/app/App.java","position":300,"original_position":300,"commit_id":"b143ba7720130303b2699c0b26b6be958fcce041","original_commit_id":"b143ba7720130303b2699c0b26b6be958fcce041","user":{"login":"conniey","id":10136526,"node_id":"MDQ6VXNlcjEwMTM2NTI2","avatar_url":"https://avatars3.githubusercontent.com/u/10136526?v=4","gravatar_id":"","url":"https://api.github.com/users/conniey","html_url":"https://github.com/conniey","followers_url":"https://api.github.com/users/conniey/followers","following_url":"https://api.github.com/users/conniey/following{/other_user}","gists_url":"https://api.github.com/users/conniey/gists{/gist_id}","starred_url":"https://api.github.com/users/conniey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/conniey/subscriptions","organizations_url":"https://api.github.com/users/conniey/orgs","repos_url":"https://api.github.com/users/conniey/repos","events_url":"https://api.github.com/users/conniey/events{/privacy}","received_events_url":"https://api.github.com/users/conniey/received_events","type":"User","site_admin":false},"body":"Curious why this object is created.","created_at":"2019-08-07T17:17:02Z","updated_at":"2019-08-07T17:20:38Z","html_url":"https://github.com/conniey/intern-project/pull/33#discussion_r311668573","pull_request_url":"https://api.github.com/repos/conniey/intern-project/pulls/33","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/conniey/intern-project/pulls/comments/311668573"},"html":{"href":"https://github.com/conniey/intern-project/pull/33#discussion_r311668573"},"pull_request":{"href":"https://api.github.com/repos/conniey/intern-project/pulls/33"}}},"pull_request":{"url":"https://api.github.com/repos/conniey/intern-project/pulls/33","id":305224537,"node_id":"MDExOlB1bGxSZXF1ZXN0MzA1MjI0NTM3","html_url":"https://github.com/conniey/intern-project/pull/33","diff_url":"https://github.com/conniey/intern-project/pull/33.diff","patch_url":"https://github.com/conniey/intern-project/pull/33.patch","issue_url":"https://api.github.com/repos/conniey/intern-project/issues/33","number":33,"state":"open","locked":false,"title":"Interfaces","user":{"login":"Intern426","id":52214834,"node_id":"MDQ6VXNlcjUyMjE0ODM0","avatar_url":"https://avatars0.githubusercontent.com/u/52214834?v=4","gravatar_id":"","url":"https://api.github.com/users/Intern426","html_url":"https://github.com/Intern426","followers_url":"https://api.github.com/users/Intern426/followers","following_url":"https://api.github.com/users/Intern426/following{/other_user}","gists_url":"https://api.github.com/users/Intern426/gists{/gist_id}","starred_url":"https://api.github.com/users/Intern426/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Intern426/subscriptions","organizations_url":"https://api.github.com/users/Intern426/orgs","repos_url":"https://api.github.com/users/Intern426/repos","events_url":"https://api.github.com/users/Intern426/events{/privacy}","received_events_url":"https://api.github.com/users/Intern426/received_events","type":"User","site_admin":false},"body":"Rearranged classes - created interfaces for text files and image files\r\nIgnored tests","created_at":"2019-08-07T16:15:41Z","updated_at":"2019-08-07T17:20:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a5dabc1ebfff3eb0ffd605757ccc124a44159d94","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/conniey/intern-project/pulls/33/commits","review_comments_url":"https://api.github.com/repos/conniey/intern-project/pulls/33/comments","review_comment_url":"https://api.github.com/repos/conniey/intern-project/pulls/comments{/number}","comments_url":"https://api.github.com/repos/conniey/intern-project/issues/33/comments","statuses_url":"https://api.github.com/repos/conniey/intern-project/statuses/b143ba7720130303b2699c0b26b6be958fcce041","head":{"label":"Intern426:Interfaces","ref":"Interfaces","sha":"b143ba7720130303b2699c0b26b6be958fcce041","user":{"login":"Intern426","id":52214834,"node_id":"MDQ6VXNlcjUyMjE0ODM0","avatar_url":"https://avatars0.githubusercontent.com/u/52214834?v=4","gravatar_id":"","url":"https://api.github.com/users/Intern426","html_url":"https://github.com/Intern426","followers_url":"https://api.github.com/users/Intern426/followers","following_url":"https://api.github.com/users/Intern426/following{/other_user}","gists_url":"https://api.github.com/users/Intern426/gists{/gist_id}","starred_url":"https://api.github.com/users/Intern426/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Intern426/subscriptions","organizations_url":"https://api.github.com/users/Intern426/orgs","repos_url":"https://api.github.com/users/Intern426/repos","events_url":"https://api.github.com/users/Intern426/events{/privacy}","received_events_url":"https://api.github.com/users/Intern426/received_events","type":"User","site_admin":false},"repo":{"id":193952927,"node_id":"MDEwOlJlcG9zaXRvcnkxOTM5NTI5Mjc=","name":"intern-project","full_name":"Intern426/intern-project","private":false,"owner":{"login":"Intern426","id":52214834,"node_id":"MDQ6VXNlcjUyMjE0ODM0","avatar_url":"https://avatars0.githubusercontent.com/u/52214834?v=4","gravatar_id":"","url":"https://api.github.com/users/Intern426","html_url":"https://github.com/Intern426","followers_url":"https://api.github.com/users/Intern426/followers","following_url":"https://api.github.com/users/Intern426/following{/other_user}","gists_url":"https://api.github.com/users/Intern426/gists{/gist_id}","starred_url":"https://api.github.com/users/Intern426/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Intern426/subscriptions","organizations_url":"https://api.github.com/users/Intern426/orgs","repos_url":"https://api.github.com/users/Intern426/repos","events_url":"https://api.github.com/users/Intern426/events{/privacy}","received_events_url":"https://api.github.com/users/Intern426/received_events","type":"User","site_admin":false},"html_url":"https://github.com/Intern426/intern-project","description":"An intern project of sorts.","fork":true,"url":"https://api.github.com/repos/Intern426/intern-project","forks_url":"https://api.github.com/repos/Intern426/intern-project/forks","keys_url":"https://api.github.com/repos/Intern426/intern-project/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Intern426/intern-project/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Intern426/intern-project/teams","hooks_url":"https://api.github.com/repos/Intern426/intern-project/hooks","issue_events_url":"https://api.github.com/repos/Intern426/intern-project/issues/events{/number}","events_url":"https://api.github.com/repos/Intern426/intern-project/events","assignees_url":"https://api.github.com/repos/Intern426/intern-project/assignees{/user}","branches_url":"https://api.github.com/repos/Intern426/intern-project/branches{/branch}","tags_url":"https://api.github.com/repos/Intern426/intern-project/tags","blobs_url":"https://api.github.com/repos/Intern426/intern-project/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Intern426/intern-project/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Intern426/intern-project/git/refs{/sha}","trees_url":"https://api.github.com/repos/Intern426/intern-project/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Intern426/intern-project/statuses/{sha}","languages_url":"https://api.github.com/repos/Intern426/intern-project/languages","stargazers_url":"https://api.github.com/repos/Intern426/intern-project/stargazers","contributors_url":"https://api.github.com/repos/Intern426/intern-project/contributors","subscribers_url":"https://api.github.com/repos/Intern426/intern-project/subscribers","subscription_url":"https://api.github.com/repos/Intern426/intern-project/subscription","commits_url":"https://api.github.com/repos/Intern426/intern-project/commits{/sha}","git_commits_url":"https://api.github.com/repos/Intern426/intern-project/git/commits{/sha}","comments_url":"https://api.github.com/repos/Intern426/intern-project/comments{/number}","issue_comment_url":"https://api.github.com/repos/Intern426/intern-project/issues/comments{/number}","contents_url":"https://api.github.com/repos/Intern426/intern-project/contents/{+path}","compare_url":"https://api.github.com/repos/Intern426/intern-project/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Intern426/intern-project/merges","archive_url":"https://api.github.com/repos/Intern426/intern-project/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Intern426/intern-project/downloads","issues_url":"https://api.github.com/repos/Intern426/intern-project/issues{/number}","pulls_url":"https://api.github.com/repos/Intern426/intern-project/pulls{/number}","milestones_url":"https://api.github.com/repos/Intern426/intern-project/milestones{/number}","notifications_url":"https://api.github.com/repos/Intern426/intern-project/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Intern426/intern-project/labels{/name}","releases_url":"https://api.github.com/repos/Intern426/intern-project/releases{/id}","deployments_url":"https://api.github.com/repos/Intern426/intern-project/deployments","created_at":"2019-06-26T17:52:23Z","updated_at":"2019-06-26T17:52:26Z","pushed_at":"2019-08-07T16:14:54Z","git_url":"git://github.com/Intern426/intern-project.git","ssh_url":"git@github.com:Intern426/intern-project.git","clone_url":"https://github.com/Intern426/intern-project.git","svn_url":"https://github.com/Intern426/intern-project","homepage":null,"size":5797,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"conniey:master","ref":"master","sha":"2ba936e7b188365b54ad72f5a418f1aa657666e6","user":{"login":"conniey","id":10136526,"node_id":"MDQ6VXNlcjEwMTM2NTI2","avatar_url":"https://avatars3.githubusercontent.com/u/10136526?v=4","gravatar_id":"","url":"https://api.github.com/users/conniey","html_url":"https://github.com/conniey","followers_url":"https://api.github.com/users/conniey/followers","following_url":"https://api.github.com/users/conniey/following{/other_user}","gists_url":"https://api.github.com/users/conniey/gists{/gist_id}","starred_url":"https://api.github.com/users/conniey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/conniey/subscriptions","organizations_url":"https://api.github.com/users/conniey/orgs","repos_url":"https://api.github.com/users/conniey/repos","events_url":"https://api.github.com/users/conniey/events{/privacy}","received_events_url":"https://api.github.com/users/conniey/received_events","type":"User","site_admin":false},"repo":{"id":193846048,"node_id":"MDEwOlJlcG9zaXRvcnkxOTM4NDYwNDg=","name":"intern-project","full_name":"conniey/intern-project","private":false,"owner":{"login":"conniey","id":10136526,"node_id":"MDQ6VXNlcjEwMTM2NTI2","avatar_url":"https://avatars3.githubusercontent.com/u/10136526?v=4","gravatar_id":"","url":"https://api.github.com/users/conniey","html_url":"https://github.com/conniey","followers_url":"https://api.github.com/users/conniey/followers","following_url":"https://api.github.com/users/conniey/following{/other_user}","gists_url":"https://api.github.com/users/conniey/gists{/gist_id}","starred_url":"https://api.github.com/users/conniey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/conniey/subscriptions","organizations_url":"https://api.github.com/users/conniey/orgs","repos_url":"https://api.github.com/users/conniey/repos","events_url":"https://api.github.com/users/conniey/events{/privacy}","received_events_url":"https://api.github.com/users/conniey/received_events","type":"User","site_admin":false},"html_url":"https://github.com/conniey/intern-project","description":"An intern project of sorts.","fork":false,"url":"https://api.github.com/repos/conniey/intern-project","forks_url":"https://api.github.com/repos/conniey/intern-project/forks","keys_url":"https://api.github.com/repos/conniey/intern-project/keys{/key_id}","collaborators_url":"https://api.github.com/repos/conniey/intern-project/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/conniey/intern-project/teams","hooks_url":"https://api.github.com/repos/conniey/intern-project/hooks","issue_events_url":"https://api.github.com/repos/conniey/intern-project/issues/events{/number}","events_url":"https://api.github.com/repos/conniey/intern-project/events","assignees_url":"https://api.github.com/repos/conniey/intern-project/assignees{/user}","branches_url":"https://api.github.com/repos/conniey/intern-project/branches{/branch}","tags_url":"https://api.github.com/repos/conniey/intern-project/tags","blobs_url":"https://api.github.com/repos/conniey/intern-project/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/conniey/intern-project/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/conniey/intern-project/git/refs{/sha}","trees_url":"https://api.github.com/repos/conniey/intern-project/git/trees{/sha}","statuses_url":"https://api.github.com/repos/conniey/intern-project/statuses/{sha}","languages_url":"https://api.github.com/repos/conniey/intern-project/languages","stargazers_url":"https://api.github.com/repos/conniey/intern-project/stargazers","contributors_url":"https://api.github.com/repos/conniey/intern-project/contributors","subscribers_url":"https://api.github.com/repos/conniey/intern-project/subscribers","subscription_url":"https://api.github.com/repos/conniey/intern-project/subscription","commits_url":"https://api.github.com/repos/conniey/intern-project/commits{/sha}","git_commits_url":"https://api.github.com/repos/conniey/intern-project/git/commits{/sha}","comments_url":"https://api.github.com/repos/conniey/intern-project/comments{/number}","issue_comment_url":"https://api.github.com/repos/conniey/intern-project/issues/comments{/number}","contents_url":"https://api.github.com/repos/conniey/intern-project/contents/{+path}","compare_url":"https://api.github.com/repos/conniey/intern-project/compare/{base}...{head}","merges_url":"https://api.github.com/repos/conniey/intern-project/merges","archive_url":"https://api.github.com/repos/conniey/intern-project/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/conniey/intern-project/downloads","issues_url":"https://api.github.com/repos/conniey/intern-project/issues{/number}","pulls_url":"https://api.github.com/repos/conniey/intern-project/pulls{/number}","milestones_url":"https://api.github.com/repos/conniey/intern-project/milestones{/number}","notifications_url":"https://api.github.com/repos/conniey/intern-project/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/conniey/intern-project/labels{/name}","releases_url":"https://api.github.com/repos/conniey/intern-project/releases{/id}","deployments_url":"https://api.github.com/repos/conniey/intern-project/deployments","created_at":"2019-06-26T06:49:26Z","updated_at":"2019-07-31T20:17:32Z","pushed_at":"2019-08-07T16:15:42Z","git_url":"git://github.com/conniey/intern-project.git","ssh_url":"git@github.com:conniey/intern-project.git","clone_url":"https://github.com/conniey/intern-project.git","svn_url":"https://github.com/conniey/intern-project","homepage":null,"size":5069,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":4,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":1,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/conniey/intern-project/pulls/33"},"html":{"href":"https://github.com/conniey/intern-project/pull/33"},"issue":{"href":"https://api.github.com/repos/conniey/intern-project/issues/33"},"comments":{"href":"https://api.github.com/repos/conniey/intern-project/issues/33/comments"},"review_comments":{"href":"https://api.github.com/repos/conniey/intern-project/pulls/33/comments"},"review_comment":{"href":"https://api.github.com/repos/conniey/intern-project/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/conniey/intern-project/pulls/33/commits"},"statuses":{"href":"https://api.github.com/repos/conniey/intern-project/statuses/b143ba7720130303b2699c0b26b6be958fcce041"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"conniey"}}