{"action":"created","comment":{"url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/comments/86000112","pull_request_review_id":6681437,"id":86000112,"diff_hunk":"@@ -0,0 +1,77 @@\n+module Bot\n+  module Command\n+    # Class for the command - /semester\n+    class Semester < Base\n+      DAYS_IN_MONTH = 30\n+\n+      def start\n+        send_message(response(\"semester_start_question\"))\n+      end\n+\n+      def semester_start\n+        user.next_command_data(Parser.parse_date(text))\n+        send_message(response(\"semester_finish_question\"))\n+      end\n+\n+      def semester_finish\n+        set_semester_data\n+        send_message(confiramation_message)\n+      end\n+\n+      def select_next_command\n+        case user.method\n+        when nil\n+          user.next_command(class_name, \"semester_start\")\n+        when \"semester_start\"\n+          user.next_command(class_name, \"semester_finish\")\n+        when \"semester_finish\"\n+          user.reset_next_command\n+        end\n+      end\n+\n+      private\n+\n+      def set_semester_data\n+        start_date  = Parser.parse_date(user.command_data)\n+        finish_date = Parser.parse_date(text)\n+        fail(BotError, \"semester_dates_invalid\") if start_date >= finish_date\n+\n+        user.update(\n+          semester_start: start_date,\n+          semester_finish: finish_date\n+        )\n+      end\n+\n+      def confiramation_message\n+        result = response(\"confirmation.main\")\n+        left_days_number = (user.semester_finish - user.semester_start).round\n+        result << left_months(left_days_number)\n+        result << rest_of_days(left_days_number)\n+      end\n+\n+      def rest_of_days(left_days_number)\n+        number_days = left_days_number % DAYS_IN_MONTH\n+        return \"\" unless number_days > 0","path":"2016/VladimirBorozna/2/lib/commands/semester.rb","position":54,"original_position":54,"commit_id":"ab67e3d3c494466e06f33fd55d98d533c7379d4a","original_commit_id":"ab67e3d3c494466e06f33fd55d98d533c7379d4a","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","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":"Use number_days.positive? instead of number_days > 0.","created_at":"2016-11-01T19:00:43Z","updated_at":"2016-11-01T19:00:43Z","html_url":"https://github.com/rubyroidlabs/bsuir-courses/pull/487#discussion_r86000112","pull_request_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/487","_links":{"self":{"href":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/comments/86000112"},"html":{"href":"https://github.com/rubyroidlabs/bsuir-courses/pull/487#discussion_r86000112"},"pull_request":{"href":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/487"}}},"pull_request":{"url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/487","id":91781620,"html_url":"https://github.com/rubyroidlabs/bsuir-courses/pull/487","diff_url":"https://github.com/rubyroidlabs/bsuir-courses/pull/487.diff","patch_url":"https://github.com/rubyroidlabs/bsuir-courses/pull/487.patch","issue_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/issues/487","number":487,"state":"open","locked":false,"title":"Implement homework-2","user":{"login":"iwsyhgia","id":6464952,"avatar_url":"https://avatars.githubusercontent.com/u/6464952?v=3","gravatar_id":"","url":"https://api.github.com/users/iwsyhgia","html_url":"https://github.com/iwsyhgia","followers_url":"https://api.github.com/users/iwsyhgia/followers","following_url":"https://api.github.com/users/iwsyhgia/following{/other_user}","gists_url":"https://api.github.com/users/iwsyhgia/gists{/gist_id}","starred_url":"https://api.github.com/users/iwsyhgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iwsyhgia/subscriptions","organizations_url":"https://api.github.com/users/iwsyhgia/orgs","repos_url":"https://api.github.com/users/iwsyhgia/repos","events_url":"https://api.github.com/users/iwsyhgia/events{/privacy}","received_events_url":"https://api.github.com/users/iwsyhgia/received_events","type":"User","site_admin":false},"body":"## Фамилия Имя\r\nБорозна Владимир\r\n\r\n## Email\r\niwsyhgia@gmail.com\r\n\r\n## Номер домашнего задания\r\n2\r\n\r\n## Комментарии\r\nРеализован 2ой уровень.\r\n\r\n\r\n","created_at":"2016-11-01T13:19:58Z","updated_at":"2016-11-01T19:00:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5749c6749ac9b8834294ce68d365b05a1fbdeea2","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/487/commits","review_comments_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/487/comments","review_comment_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/issues/487/comments","statuses_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/statuses/ab67e3d3c494466e06f33fd55d98d533c7379d4a","head":{"label":"iwsyhgia:homework-2","ref":"homework-2","sha":"ab67e3d3c494466e06f33fd55d98d533c7379d4a","user":{"login":"iwsyhgia","id":6464952,"avatar_url":"https://avatars.githubusercontent.com/u/6464952?v=3","gravatar_id":"","url":"https://api.github.com/users/iwsyhgia","html_url":"https://github.com/iwsyhgia","followers_url":"https://api.github.com/users/iwsyhgia/followers","following_url":"https://api.github.com/users/iwsyhgia/following{/other_user}","gists_url":"https://api.github.com/users/iwsyhgia/gists{/gist_id}","starred_url":"https://api.github.com/users/iwsyhgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iwsyhgia/subscriptions","organizations_url":"https://api.github.com/users/iwsyhgia/orgs","repos_url":"https://api.github.com/users/iwsyhgia/repos","events_url":"https://api.github.com/users/iwsyhgia/events{/privacy}","received_events_url":"https://api.github.com/users/iwsyhgia/received_events","type":"User","site_admin":false},"repo":{"id":71235357,"name":"bsuir-courses","full_name":"iwsyhgia/bsuir-courses","owner":{"login":"iwsyhgia","id":6464952,"avatar_url":"https://avatars.githubusercontent.com/u/6464952?v=3","gravatar_id":"","url":"https://api.github.com/users/iwsyhgia","html_url":"https://github.com/iwsyhgia","followers_url":"https://api.github.com/users/iwsyhgia/followers","following_url":"https://api.github.com/users/iwsyhgia/following{/other_user}","gists_url":"https://api.github.com/users/iwsyhgia/gists{/gist_id}","starred_url":"https://api.github.com/users/iwsyhgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iwsyhgia/subscriptions","organizations_url":"https://api.github.com/users/iwsyhgia/orgs","repos_url":"https://api.github.com/users/iwsyhgia/repos","events_url":"https://api.github.com/users/iwsyhgia/events{/privacy}","received_events_url":"https://api.github.com/users/iwsyhgia/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/iwsyhgia/bsuir-courses","description":"This is common repository for all student to submit all their homeworks","fork":true,"url":"https://api.github.com/repos/iwsyhgia/bsuir-courses","forks_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/forks","keys_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/keys{/key_id}","collaborators_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/teams","hooks_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/hooks","issue_events_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/issues/events{/number}","events_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/events","assignees_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/assignees{/user}","branches_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/branches{/branch}","tags_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/tags","blobs_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/git/refs{/sha}","trees_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/git/trees{/sha}","statuses_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/statuses/{sha}","languages_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/languages","stargazers_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/stargazers","contributors_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/contributors","subscribers_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/subscribers","subscription_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/subscription","commits_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/commits{/sha}","git_commits_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/git/commits{/sha}","comments_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/comments{/number}","issue_comment_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/issues/comments{/number}","contents_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/contents/{+path}","compare_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/compare/{base}...{head}","merges_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/merges","archive_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/downloads","issues_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/issues{/number}","pulls_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/pulls{/number}","milestones_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/milestones{/number}","notifications_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/labels{/name}","releases_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/releases{/id}","deployments_url":"https://api.github.com/repos/iwsyhgia/bsuir-courses/deployments","created_at":"2016-10-18T10:08:52Z","updated_at":"2016-10-18T10:08:54Z","pushed_at":"2016-11-01T19:00:11Z","git_url":"git://github.com/iwsyhgia/bsuir-courses.git","ssh_url":"git@github.com:iwsyhgia/bsuir-courses.git","clone_url":"https://github.com/iwsyhgia/bsuir-courses.git","svn_url":"https://github.com/iwsyhgia/bsuir-courses","homepage":null,"size":2097,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rubyroidlabs:master","ref":"master","sha":"c90534441048659dd79cc673cbf2ee8a5978048e","user":{"login":"rubyroidlabs","id":5137565,"avatar_url":"https://avatars.githubusercontent.com/u/5137565?v=3","gravatar_id":"","url":"https://api.github.com/users/rubyroidlabs","html_url":"https://github.com/rubyroidlabs","followers_url":"https://api.github.com/users/rubyroidlabs/followers","following_url":"https://api.github.com/users/rubyroidlabs/following{/other_user}","gists_url":"https://api.github.com/users/rubyroidlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/rubyroidlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rubyroidlabs/subscriptions","organizations_url":"https://api.github.com/users/rubyroidlabs/orgs","repos_url":"https://api.github.com/users/rubyroidlabs/repos","events_url":"https://api.github.com/users/rubyroidlabs/events{/privacy}","received_events_url":"https://api.github.com/users/rubyroidlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":14405320,"name":"bsuir-courses","full_name":"rubyroidlabs/bsuir-courses","owner":{"login":"rubyroidlabs","id":5137565,"avatar_url":"https://avatars.githubusercontent.com/u/5137565?v=3","gravatar_id":"","url":"https://api.github.com/users/rubyroidlabs","html_url":"https://github.com/rubyroidlabs","followers_url":"https://api.github.com/users/rubyroidlabs/followers","following_url":"https://api.github.com/users/rubyroidlabs/following{/other_user}","gists_url":"https://api.github.com/users/rubyroidlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/rubyroidlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rubyroidlabs/subscriptions","organizations_url":"https://api.github.com/users/rubyroidlabs/orgs","repos_url":"https://api.github.com/users/rubyroidlabs/repos","events_url":"https://api.github.com/users/rubyroidlabs/events{/privacy}","received_events_url":"https://api.github.com/users/rubyroidlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rubyroidlabs/bsuir-courses","description":"This is common repository for all student to submit all their homeworks","fork":false,"url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses","forks_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/forks","keys_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/teams","hooks_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/hooks","issue_events_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/issues/events{/number}","events_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/events","assignees_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/assignees{/user}","branches_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/branches{/branch}","tags_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/tags","blobs_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/git/refs{/sha}","trees_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/statuses/{sha}","languages_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/languages","stargazers_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/stargazers","contributors_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/contributors","subscribers_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/subscribers","subscription_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/subscription","commits_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/commits{/sha}","git_commits_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/git/commits{/sha}","comments_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/comments{/number}","issue_comment_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/issues/comments{/number}","contents_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/contents/{+path}","compare_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/merges","archive_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/downloads","issues_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/issues{/number}","pulls_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls{/number}","milestones_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/milestones{/number}","notifications_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/labels{/name}","releases_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/releases{/id}","deployments_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/deployments","created_at":"2013-11-14T19:55:12Z","updated_at":"2016-11-01T17:28:44Z","pushed_at":"2016-11-01T19:00:12Z","git_url":"git://github.com/rubyroidlabs/bsuir-courses.git","ssh_url":"git@github.com:rubyroidlabs/bsuir-courses.git","clone_url":"https://github.com/rubyroidlabs/bsuir-courses.git","svn_url":"https://github.com/rubyroidlabs/bsuir-courses","homepage":null,"size":7323,"stargazers_count":30,"watchers_count":30,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":174,"mirror_url":null,"open_issues_count":15,"forks":174,"open_issues":15,"watchers":30,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/487"},"html":{"href":"https://github.com/rubyroidlabs/bsuir-courses/pull/487"},"issue":{"href":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/issues/487"},"comments":{"href":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/issues/487/comments"},"review_comments":{"href":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/487/comments"},"review_comment":{"href":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/487/commits"},"statuses":{"href":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/statuses/ab67e3d3c494466e06f33fd55d98d533c7379d4a"}}}}
{"actor":{"display_login":"houndci-bot"}}