{"action":"created","comment":{"url":"https://api.github.com/repos/Ada-C9/hotel/pulls/comments/175330522","pull_request_review_id":104838873,"id":175330522,"diff_hunk":"@@ -0,0 +1,200 @@\n+\n+require_relative 'room_wave1'\n+require_relative 'reservation_wave1'\n+require_relative 'block'\n+require 'date'\n+\n+\n+module Hotel\n+  NUMBER_OF_ROOMS = 20\n+\n+  class Admin\n+    attr_reader :list_of_rooms,:all_reservations, :block_reservation\n+\n+    def initialize\n+\n+      @all_reservations = []\n+      @block_reservation = []\n+      @list_of_rooms = create_rooms\n+    end\n+\n+    # As an administrator, I can access the list of all of the rooms in the hotel\n+    def get_list\n+      rooms = []\n+      @list_of_rooms.each do |room|\n+        rooms << room.number\n+      end\n+      return rooms\n+\n+    end\n+\n+    #- As an administrator, I can reserve a room for a given date range\n+    def make_reservation(start_date,end_date)\n+      room_number = @list_of_rooms.sample\n+      reservation = Hotel::Reservation.new(start_date,end_date,room_number)\n+      @all_reservations << reservation\n+      return @all_reservations\n+    end\n+\n+    # - As an administrator, I can access the list of reservations for a specific date\n+    def get_reservations(date)\n+\n+      if date.class!= Date\n+        raise ArgumentError.new(\"invalid date\")\n+      end\n+\n+      @all_reservations.each do |res|\n+        list =[]\n+        if res.start_date <= date && res.end_date > date\n+          list << res\n+        end\n+        return list\n+      end\n+\n+    end\n+\n+    # As an administrator, I can view a list of rooms that are not reserved for a given date range\n+    def list_of_available_rooms(date)\n+      if date.class!= Date\n+        raise ArgumentError.new(\"invalid date\")\n+      end\n+\n+      reserved_list = get_reservations(date)\n+      reserved_rooms = []\n+      reserved_list.each do |reservation|\n+        reserved_rooms << reservation.room_number\n+      end\n+      return @list_of_rooms - reserved_rooms\n+    end\n+\n+    # To reserve available rooms for a given date range also eliminates rooms that are in reserved in a block\n+    def reserve_available_rooms(start_date,end_date)\n+\n+      rooms_available_range = get_available_rooms(start_date,end_date)\n+\n+      if rooms_available_range.empty?\n+        raise Exception.new(\"No rooms are available\")\n+      else\n+        list_room_block = get_block_room(start_date,end_date)\n+        rooms_available_range = rooms_available_range - list_room_block\n+        availability = rooms_available_range[0]\n+\n+        reservation = Hotel::Reservation.new(start_date,end_date,availability)\n+        @all_reservations << reservation\n+        return @all_reservations\n+      end\n+    end\n+\n+    # - As an administrator, I can get the total cost for a given reservation","path":"lib/admin_block.rb","position":88,"original_position":88,"commit_id":"9576cf4c6be260827df8de226473a3660b6c515a","original_commit_id":"9576cf4c6be260827df8de226473a3660b6c515a","user":{"login":"CheezItMan","id":1177416,"avatar_url":"https://avatars3.githubusercontent.com/u/1177416?v=4","gravatar_id":"","url":"https://api.github.com/users/CheezItMan","html_url":"https://github.com/CheezItMan","followers_url":"https://api.github.com/users/CheezItMan/followers","following_url":"https://api.github.com/users/CheezItMan/following{/other_user}","gists_url":"https://api.github.com/users/CheezItMan/gists{/gist_id}","starred_url":"https://api.github.com/users/CheezItMan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CheezItMan/subscriptions","organizations_url":"https://api.github.com/users/CheezItMan/orgs","repos_url":"https://api.github.com/users/CheezItMan/repos","events_url":"https://api.github.com/users/CheezItMan/events{/privacy}","received_events_url":"https://api.github.com/users/CheezItMan/received_events","type":"User","site_admin":false},"body":"This is a cost for a date range, not a given reservation.  Small distinct difference.  ","created_at":"2018-03-19T04:36:15Z","updated_at":"2018-03-19T04:43:26Z","html_url":"https://github.com/Ada-C9/hotel/pull/10#discussion_r175330522","pull_request_url":"https://api.github.com/repos/Ada-C9/hotel/pulls/10","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/Ada-C9/hotel/pulls/comments/175330522"},"html":{"href":"https://github.com/Ada-C9/hotel/pull/10#discussion_r175330522"},"pull_request":{"href":"https://api.github.com/repos/Ada-C9/hotel/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/Ada-C9/hotel/pulls/10","id":174254716,"html_url":"https://github.com/Ada-C9/hotel/pull/10","diff_url":"https://github.com/Ada-C9/hotel/pull/10.diff","patch_url":"https://github.com/Ada-C9/hotel/pull/10.patch","issue_url":"https://api.github.com/repos/Ada-C9/hotel/issues/10","number":10,"state":"open","locked":false,"title":"Ampers::Aruna","user":{"login":"aruna79","id":35058606,"avatar_url":"https://avatars2.githubusercontent.com/u/35058606?v=4","gravatar_id":"","url":"https://api.github.com/users/aruna79","html_url":"https://github.com/aruna79","followers_url":"https://api.github.com/users/aruna79/followers","following_url":"https://api.github.com/users/aruna79/following{/other_user}","gists_url":"https://api.github.com/users/aruna79/gists{/gist_id}","starred_url":"https://api.github.com/users/aruna79/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aruna79/subscriptions","organizations_url":"https://api.github.com/users/aruna79/orgs","repos_url":"https://api.github.com/users/aruna79/repos","events_url":"https://api.github.com/users/aruna79/events{/privacy}","received_events_url":"https://api.github.com/users/aruna79/received_events","type":"User","site_admin":false},"body":"# Hotel\r\nCongratulations! You're submitting your assignment!\r\n\r\n## Comprehension Questions\r\nQuestion | Answer\r\n:------------- | :-------------\r\nDescribe a design decision you had to make when working on this project. What options were you considering? What helped you make your final decision? | I first used reservation class to create make_reservation method but decided to create it in the admin class. I also used get_available_rooms as helper method to get all the available rooms in the range so that I can reuse the code in create_block and reserve _available methods\r\nDescribe a concept that you gained more clarity on as you worked on this assignment. | I got more clarity on using date class and methods.\r\nDescribe a _nominal test_ that you wrote for this assignment. | In \"reserve_block_room\" it adds the new reserved block to the list of all reservations\"\r\nDescribe an _edge case test_ that you wrote for this assignment. | \"raises error if there are no rooms available in block\"\r\nHow do you feel you did in writing pseudocode first, then writing the tests and then the code? | Writing pseudocode really helped to plan and structure.I could only write few tests and write the code and then update the remaining tests.Still trying to write all the testsfirst and then write code.\r\n","created_at":"2018-03-12T01:18:01Z","updated_at":"2018-03-19T04:43:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1a5adc2d79cb747a66ef7de192bb3f275dac9447","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Ada-C9/hotel/pulls/10/commits","review_comments_url":"https://api.github.com/repos/Ada-C9/hotel/pulls/10/comments","review_comment_url":"https://api.github.com/repos/Ada-C9/hotel/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Ada-C9/hotel/issues/10/comments","statuses_url":"https://api.github.com/repos/Ada-C9/hotel/statuses/9576cf4c6be260827df8de226473a3660b6c515a","head":{"label":"aruna79:master","ref":"master","sha":"9576cf4c6be260827df8de226473a3660b6c515a","user":{"login":"aruna79","id":35058606,"avatar_url":"https://avatars2.githubusercontent.com/u/35058606?v=4","gravatar_id":"","url":"https://api.github.com/users/aruna79","html_url":"https://github.com/aruna79","followers_url":"https://api.github.com/users/aruna79/followers","following_url":"https://api.github.com/users/aruna79/following{/other_user}","gists_url":"https://api.github.com/users/aruna79/gists{/gist_id}","starred_url":"https://api.github.com/users/aruna79/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aruna79/subscriptions","organizations_url":"https://api.github.com/users/aruna79/orgs","repos_url":"https://api.github.com/users/aruna79/repos","events_url":"https://api.github.com/users/aruna79/events{/privacy}","received_events_url":"https://api.github.com/users/aruna79/received_events","type":"User","site_admin":false},"repo":{"id":123976502,"name":"hotel","full_name":"aruna79/hotel","owner":{"login":"aruna79","id":35058606,"avatar_url":"https://avatars2.githubusercontent.com/u/35058606?v=4","gravatar_id":"","url":"https://api.github.com/users/aruna79","html_url":"https://github.com/aruna79","followers_url":"https://api.github.com/users/aruna79/followers","following_url":"https://api.github.com/users/aruna79/following{/other_user}","gists_url":"https://api.github.com/users/aruna79/gists{/gist_id}","starred_url":"https://api.github.com/users/aruna79/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aruna79/subscriptions","organizations_url":"https://api.github.com/users/aruna79/orgs","repos_url":"https://api.github.com/users/aruna79/repos","events_url":"https://api.github.com/users/aruna79/events{/privacy}","received_events_url":"https://api.github.com/users/aruna79/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aruna79/hotel","description":null,"fork":true,"url":"https://api.github.com/repos/aruna79/hotel","forks_url":"https://api.github.com/repos/aruna79/hotel/forks","keys_url":"https://api.github.com/repos/aruna79/hotel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aruna79/hotel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aruna79/hotel/teams","hooks_url":"https://api.github.com/repos/aruna79/hotel/hooks","issue_events_url":"https://api.github.com/repos/aruna79/hotel/issues/events{/number}","events_url":"https://api.github.com/repos/aruna79/hotel/events","assignees_url":"https://api.github.com/repos/aruna79/hotel/assignees{/user}","branches_url":"https://api.github.com/repos/aruna79/hotel/branches{/branch}","tags_url":"https://api.github.com/repos/aruna79/hotel/tags","blobs_url":"https://api.github.com/repos/aruna79/hotel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aruna79/hotel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aruna79/hotel/git/refs{/sha}","trees_url":"https://api.github.com/repos/aruna79/hotel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aruna79/hotel/statuses/{sha}","languages_url":"https://api.github.com/repos/aruna79/hotel/languages","stargazers_url":"https://api.github.com/repos/aruna79/hotel/stargazers","contributors_url":"https://api.github.com/repos/aruna79/hotel/contributors","subscribers_url":"https://api.github.com/repos/aruna79/hotel/subscribers","subscription_url":"https://api.github.com/repos/aruna79/hotel/subscription","commits_url":"https://api.github.com/repos/aruna79/hotel/commits{/sha}","git_commits_url":"https://api.github.com/repos/aruna79/hotel/git/commits{/sha}","comments_url":"https://api.github.com/repos/aruna79/hotel/comments{/number}","issue_comment_url":"https://api.github.com/repos/aruna79/hotel/issues/comments{/number}","contents_url":"https://api.github.com/repos/aruna79/hotel/contents/{+path}","compare_url":"https://api.github.com/repos/aruna79/hotel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aruna79/hotel/merges","archive_url":"https://api.github.com/repos/aruna79/hotel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aruna79/hotel/downloads","issues_url":"https://api.github.com/repos/aruna79/hotel/issues{/number}","pulls_url":"https://api.github.com/repos/aruna79/hotel/pulls{/number}","milestones_url":"https://api.github.com/repos/aruna79/hotel/milestones{/number}","notifications_url":"https://api.github.com/repos/aruna79/hotel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aruna79/hotel/labels{/name}","releases_url":"https://api.github.com/repos/aruna79/hotel/releases{/id}","deployments_url":"https://api.github.com/repos/aruna79/hotel/deployments","created_at":"2018-03-05T20:44:53Z","updated_at":"2018-03-13T23:57:49Z","pushed_at":"2018-03-13T23:57:47Z","git_url":"git://github.com/aruna79/hotel.git","ssh_url":"git@github.com:aruna79/hotel.git","clone_url":"https://github.com/aruna79/hotel.git","svn_url":"https://github.com/aruna79/hotel","homepage":null,"size":496,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Ada-C9:master","ref":"master","sha":"a648e5b13d50e8552978e78b3d13ac95f21f9401","user":{"login":"Ada-C9","id":35278806,"avatar_url":"https://avatars0.githubusercontent.com/u/35278806?v=4","gravatar_id":"","url":"https://api.github.com/users/Ada-C9","html_url":"https://github.com/Ada-C9","followers_url":"https://api.github.com/users/Ada-C9/followers","following_url":"https://api.github.com/users/Ada-C9/following{/other_user}","gists_url":"https://api.github.com/users/Ada-C9/gists{/gist_id}","starred_url":"https://api.github.com/users/Ada-C9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ada-C9/subscriptions","organizations_url":"https://api.github.com/users/Ada-C9/orgs","repos_url":"https://api.github.com/users/Ada-C9/repos","events_url":"https://api.github.com/users/Ada-C9/events{/privacy}","received_events_url":"https://api.github.com/users/Ada-C9/received_events","type":"Organization","site_admin":false},"repo":{"id":122494931,"name":"hotel","full_name":"Ada-C9/hotel","owner":{"login":"Ada-C9","id":35278806,"avatar_url":"https://avatars0.githubusercontent.com/u/35278806?v=4","gravatar_id":"","url":"https://api.github.com/users/Ada-C9","html_url":"https://github.com/Ada-C9","followers_url":"https://api.github.com/users/Ada-C9/followers","following_url":"https://api.github.com/users/Ada-C9/following{/other_user}","gists_url":"https://api.github.com/users/Ada-C9/gists{/gist_id}","starred_url":"https://api.github.com/users/Ada-C9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ada-C9/subscriptions","organizations_url":"https://api.github.com/users/Ada-C9/orgs","repos_url":"https://api.github.com/users/Ada-C9/repos","events_url":"https://api.github.com/users/Ada-C9/events{/privacy}","received_events_url":"https://api.github.com/users/Ada-C9/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Ada-C9/hotel","description":null,"fork":true,"url":"https://api.github.com/repos/Ada-C9/hotel","forks_url":"https://api.github.com/repos/Ada-C9/hotel/forks","keys_url":"https://api.github.com/repos/Ada-C9/hotel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Ada-C9/hotel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Ada-C9/hotel/teams","hooks_url":"https://api.github.com/repos/Ada-C9/hotel/hooks","issue_events_url":"https://api.github.com/repos/Ada-C9/hotel/issues/events{/number}","events_url":"https://api.github.com/repos/Ada-C9/hotel/events","assignees_url":"https://api.github.com/repos/Ada-C9/hotel/assignees{/user}","branches_url":"https://api.github.com/repos/Ada-C9/hotel/branches{/branch}","tags_url":"https://api.github.com/repos/Ada-C9/hotel/tags","blobs_url":"https://api.github.com/repos/Ada-C9/hotel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Ada-C9/hotel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Ada-C9/hotel/git/refs{/sha}","trees_url":"https://api.github.com/repos/Ada-C9/hotel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Ada-C9/hotel/statuses/{sha}","languages_url":"https://api.github.com/repos/Ada-C9/hotel/languages","stargazers_url":"https://api.github.com/repos/Ada-C9/hotel/stargazers","contributors_url":"https://api.github.com/repos/Ada-C9/hotel/contributors","subscribers_url":"https://api.github.com/repos/Ada-C9/hotel/subscribers","subscription_url":"https://api.github.com/repos/Ada-C9/hotel/subscription","commits_url":"https://api.github.com/repos/Ada-C9/hotel/commits{/sha}","git_commits_url":"https://api.github.com/repos/Ada-C9/hotel/git/commits{/sha}","comments_url":"https://api.github.com/repos/Ada-C9/hotel/comments{/number}","issue_comment_url":"https://api.github.com/repos/Ada-C9/hotel/issues/comments{/number}","contents_url":"https://api.github.com/repos/Ada-C9/hotel/contents/{+path}","compare_url":"https://api.github.com/repos/Ada-C9/hotel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Ada-C9/hotel/merges","archive_url":"https://api.github.com/repos/Ada-C9/hotel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Ada-C9/hotel/downloads","issues_url":"https://api.github.com/repos/Ada-C9/hotel/issues{/number}","pulls_url":"https://api.github.com/repos/Ada-C9/hotel/pulls{/number}","milestones_url":"https://api.github.com/repos/Ada-C9/hotel/milestones{/number}","notifications_url":"https://api.github.com/repos/Ada-C9/hotel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Ada-C9/hotel/labels{/name}","releases_url":"https://api.github.com/repos/Ada-C9/hotel/releases{/id}","deployments_url":"https://api.github.com/repos/Ada-C9/hotel/deployments","created_at":"2018-02-22T15:09:53Z","updated_at":"2018-03-15T01:25:09Z","pushed_at":"2018-03-18T23:50:48Z","git_url":"git://github.com/Ada-C9/hotel.git","ssh_url":"git@github.com:Ada-C9/hotel.git","clone_url":"https://github.com/Ada-C9/hotel.git","svn_url":"https://github.com/Ada-C9/hotel","homepage":null,"size":20,"stargazers_count":1,"watchers_count":1,"language":null,"has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":49,"mirror_url":null,"archived":false,"open_issues_count":46,"license":null,"forks":49,"open_issues":46,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Ada-C9/hotel/pulls/10"},"html":{"href":"https://github.com/Ada-C9/hotel/pull/10"},"issue":{"href":"https://api.github.com/repos/Ada-C9/hotel/issues/10"},"comments":{"href":"https://api.github.com/repos/Ada-C9/hotel/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/Ada-C9/hotel/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/Ada-C9/hotel/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Ada-C9/hotel/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/Ada-C9/hotel/statuses/9576cf4c6be260827df8de226473a3660b6c515a"}},"author_association":"NONE"}}
{"actor":{"display_login":"CheezItMan"}}