{"action":"created","comment":{"url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/comments/86700730","pull_request_review_id":7345211,"id":86700730,"diff_hunk":"@@ -0,0 +1,99 @@\n+require_relative \"start\"\n+require_relative \"user\"\n+require_relative \"semester\"\n+require_relative \"subject\"\n+require_relative \"status\"\n+require_relative \"reset\"\n+require_relative \"submit\"\n+require_relative \"cancel\"\n+\n+COMMON_YEAR_DAYS_IN_MONTH = [nil, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n+MONTHS = [nil, \"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"]\n+\n+# Class Servlet.\n+class MyServlet < WEBrick::HTTPServlet::AbstractServlet\n+  def initialize(server, bot)\n+    super server\n+    @bot = bot\n+  end\n+\n+  def do_POST(request, response)\n+    body =  Telegram::Bot::Types::Update.new(JSON.parse request.body.gsub('\\n', \" \"))\n+    body.callback_query.nil? ? handler(body.message, true) : handler(body.callback_query, false)\n+    response.status = 200\n+    response.body = \"Success.\"\n+  end\n+\n+  # TODO -> make shorter.\n+  def handler(message, from_text_message)\n+    @user = User.new(message.from.id)\n+    text = from_text_message ? message.text : message.data\n+    return nil unless text_validation(text, from_text_message)\n+    answer = if !@user.sys[\"subjects_phase\"].zero? then Subject.new(@user, text).run\n+             elsif !@user.sys[\"semester_phase\"].zero? then Semester.new(@user, text).run\n+             elsif !@user.sys[\"submission_phase\"].zero? then Submission.new(@user, text).run\n+             else answer = try_ordinary_action(text, message.from.first_name)\n+    end\n+    send_message(message.from.id, text, answer)\n+  end\n+\n+  def text_validation(text, from_text_message)","path":"2016/VladislavErmolkin/2/lib/servlet.rb","position":40,"original_position":40,"commit_id":"0d091f13b8f80151e7d1033227ed3723131352fe","original_commit_id":"0d091f13b8f80151e7d1033227ed3723131352fe","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":"Assignment Branch Condition size for text_validation is too high. [34.79/15]<br>Cyclomatic complexity for text_validation is too high. [12/6]<br>Perceived complexity for text_validation is too high. [12/7]","created_at":"2016-11-07T00:08:22Z","updated_at":"2016-11-07T00:08:22Z","html_url":"https://github.com/rubyroidlabs/bsuir-courses/pull/496#discussion_r86700730","pull_request_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/496","_links":{"self":{"href":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/comments/86700730"},"html":{"href":"https://github.com/rubyroidlabs/bsuir-courses/pull/496#discussion_r86700730"},"pull_request":{"href":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/496"}}},"pull_request":{"url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/496","id":92095109,"html_url":"https://github.com/rubyroidlabs/bsuir-courses/pull/496","diff_url":"https://github.com/rubyroidlabs/bsuir-courses/pull/496.diff","patch_url":"https://github.com/rubyroidlabs/bsuir-courses/pull/496.patch","issue_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/issues/496","number":496,"state":"open","locked":false,"title":"Homework 2","user":{"login":"Stigmater","id":11902012,"avatar_url":"https://avatars.githubusercontent.com/u/11902012?v=3","gravatar_id":"","url":"https://api.github.com/users/Stigmater","html_url":"https://github.com/Stigmater","followers_url":"https://api.github.com/users/Stigmater/followers","following_url":"https://api.github.com/users/Stigmater/following{/other_user}","gists_url":"https://api.github.com/users/Stigmater/gists{/gist_id}","starred_url":"https://api.github.com/users/Stigmater/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stigmater/subscriptions","organizations_url":"https://api.github.com/users/Stigmater/orgs","repos_url":"https://api.github.com/users/Stigmater/repos","events_url":"https://api.github.com/users/Stigmater/events{/privacy}","received_events_url":"https://api.github.com/users/Stigmater/received_events","type":"User","site_admin":false},"body":"## Фамилия Имя\r\nЕрмолкин Влад\r\n\r\n## Email\r\nStigmatervlad@gmail.com\r\n\r\n## Номер домашнего задания\r\n2\r\n\r\n## Ссылка на видео с демо работы\r\nhttps://youtu.be/oyEL9yHOBtw\r\n\r\n## Комментарии\r\nПрошел два уровня. \r\nПользовательские данные хранятся в redis.\r\nВалидация всех данных (до первого бага).\r\nСтилизация под Марвина из \"Путеводителя для путешествующих автостопом по Галактике\". Про него еще Radiohead песню написали. Да, такие вот дела. \r\nОстальное можно узнать из видео.","created_at":"2016-11-03T04:22:07Z","updated_at":"2016-11-07T00:08:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"78990a4cfb35dc20bdca8e5b030bbefe45b92aa8","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/496/commits","review_comments_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/496/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/496/comments","statuses_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/statuses/0d091f13b8f80151e7d1033227ed3723131352fe","head":{"label":"Stigmater:homework-2","ref":"homework-2","sha":"0d091f13b8f80151e7d1033227ed3723131352fe","user":{"login":"Stigmater","id":11902012,"avatar_url":"https://avatars.githubusercontent.com/u/11902012?v=3","gravatar_id":"","url":"https://api.github.com/users/Stigmater","html_url":"https://github.com/Stigmater","followers_url":"https://api.github.com/users/Stigmater/followers","following_url":"https://api.github.com/users/Stigmater/following{/other_user}","gists_url":"https://api.github.com/users/Stigmater/gists{/gist_id}","starred_url":"https://api.github.com/users/Stigmater/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stigmater/subscriptions","organizations_url":"https://api.github.com/users/Stigmater/orgs","repos_url":"https://api.github.com/users/Stigmater/repos","events_url":"https://api.github.com/users/Stigmater/events{/privacy}","received_events_url":"https://api.github.com/users/Stigmater/received_events","type":"User","site_admin":false},"repo":{"id":71520812,"name":"bsuir-courses","full_name":"Stigmater/bsuir-courses","owner":{"login":"Stigmater","id":11902012,"avatar_url":"https://avatars.githubusercontent.com/u/11902012?v=3","gravatar_id":"","url":"https://api.github.com/users/Stigmater","html_url":"https://github.com/Stigmater","followers_url":"https://api.github.com/users/Stigmater/followers","following_url":"https://api.github.com/users/Stigmater/following{/other_user}","gists_url":"https://api.github.com/users/Stigmater/gists{/gist_id}","starred_url":"https://api.github.com/users/Stigmater/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stigmater/subscriptions","organizations_url":"https://api.github.com/users/Stigmater/orgs","repos_url":"https://api.github.com/users/Stigmater/repos","events_url":"https://api.github.com/users/Stigmater/events{/privacy}","received_events_url":"https://api.github.com/users/Stigmater/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Stigmater/bsuir-courses","description":"This is common repository for all student to submit all their homeworks","fork":true,"url":"https://api.github.com/repos/Stigmater/bsuir-courses","forks_url":"https://api.github.com/repos/Stigmater/bsuir-courses/forks","keys_url":"https://api.github.com/repos/Stigmater/bsuir-courses/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Stigmater/bsuir-courses/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Stigmater/bsuir-courses/teams","hooks_url":"https://api.github.com/repos/Stigmater/bsuir-courses/hooks","issue_events_url":"https://api.github.com/repos/Stigmater/bsuir-courses/issues/events{/number}","events_url":"https://api.github.com/repos/Stigmater/bsuir-courses/events","assignees_url":"https://api.github.com/repos/Stigmater/bsuir-courses/assignees{/user}","branches_url":"https://api.github.com/repos/Stigmater/bsuir-courses/branches{/branch}","tags_url":"https://api.github.com/repos/Stigmater/bsuir-courses/tags","blobs_url":"https://api.github.com/repos/Stigmater/bsuir-courses/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Stigmater/bsuir-courses/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Stigmater/bsuir-courses/git/refs{/sha}","trees_url":"https://api.github.com/repos/Stigmater/bsuir-courses/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Stigmater/bsuir-courses/statuses/{sha}","languages_url":"https://api.github.com/repos/Stigmater/bsuir-courses/languages","stargazers_url":"https://api.github.com/repos/Stigmater/bsuir-courses/stargazers","contributors_url":"https://api.github.com/repos/Stigmater/bsuir-courses/contributors","subscribers_url":"https://api.github.com/repos/Stigmater/bsuir-courses/subscribers","subscription_url":"https://api.github.com/repos/Stigmater/bsuir-courses/subscription","commits_url":"https://api.github.com/repos/Stigmater/bsuir-courses/commits{/sha}","git_commits_url":"https://api.github.com/repos/Stigmater/bsuir-courses/git/commits{/sha}","comments_url":"https://api.github.com/repos/Stigmater/bsuir-courses/comments{/number}","issue_comment_url":"https://api.github.com/repos/Stigmater/bsuir-courses/issues/comments{/number}","contents_url":"https://api.github.com/repos/Stigmater/bsuir-courses/contents/{+path}","compare_url":"https://api.github.com/repos/Stigmater/bsuir-courses/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Stigmater/bsuir-courses/merges","archive_url":"https://api.github.com/repos/Stigmater/bsuir-courses/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Stigmater/bsuir-courses/downloads","issues_url":"https://api.github.com/repos/Stigmater/bsuir-courses/issues{/number}","pulls_url":"https://api.github.com/repos/Stigmater/bsuir-courses/pulls{/number}","milestones_url":"https://api.github.com/repos/Stigmater/bsuir-courses/milestones{/number}","notifications_url":"https://api.github.com/repos/Stigmater/bsuir-courses/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Stigmater/bsuir-courses/labels{/name}","releases_url":"https://api.github.com/repos/Stigmater/bsuir-courses/releases{/id}","deployments_url":"https://api.github.com/repos/Stigmater/bsuir-courses/deployments","created_at":"2016-10-21T02:06:59Z","updated_at":"2016-10-21T02:07:00Z","pushed_at":"2016-11-07T00:08:12Z","git_url":"git://github.com/Stigmater/bsuir-courses.git","ssh_url":"git@github.com:Stigmater/bsuir-courses.git","clone_url":"https://github.com/Stigmater/bsuir-courses.git","svn_url":"https://github.com/Stigmater/bsuir-courses","homepage":null,"size":7053,"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":"8845a6bf81b5068f624178a5f9714d624db5106b","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-03T04:38:40Z","pushed_at":"2016-11-07T00:08:13Z","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":12327,"stargazers_count":31,"watchers_count":31,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":175,"mirror_url":null,"open_issues_count":16,"forks":175,"open_issues":16,"watchers":31,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/496"},"html":{"href":"https://github.com/rubyroidlabs/bsuir-courses/pull/496"},"issue":{"href":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/issues/496"},"comments":{"href":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/issues/496/comments"},"review_comments":{"href":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/496/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/496/commits"},"statuses":{"href":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/statuses/0d091f13b8f80151e7d1033227ed3723131352fe"}}}}
{"actor":{"display_login":"houndci-bot"}}