{"action":"created","comment":{"url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/comments/85764920","pull_request_review_id":6460907,"id":85764920,"diff_hunk":"@@ -0,0 +1,81 @@\n+class DateParser\n+  def initialize(date)\n+    time_ar = []\n+    0.upto(2) do |i|\n+      time_ar[i] = date[0..date.index(\".\").to_i-1]\n+      date = date[(date.index(\".\").to_i+1)..date.size]\n+    end\n+    @day = time_ar[0].to_i\n+    @month = time_ar[1].to_i\n+    @year = time_ar[2].to_i\n+  end\n+\n+  def self.difference(date_end, date_start)\n+    year_diff = date_end.year - date_start.year\n+    if date_end.month - date_start.month < 0\n+      year_diff -= 1\n+      month_diff = date_end.month - date_start.month + 12\n+    else \n+      month_diff = date_end.month - date_start.month\n+    end\n+    if date_end.day - date_start.day < 0\n+      month_diff -= 1\n+      day_diff = date_end.day - date_start.day + 30\n+    else \n+      day_diff = date_end.day - date_start.day\n+    end\n+    case month_diff\n+    when 1\n+      month_diff_str = \"1 месяц\"\n+    when 2..4\n+      month_diff_str = month_diff.to_s + \" месяца\"\n+    else\n+      month_diff_str = month_diff.to_s + \" месяцев\"\n+    end\n+    case day_diff\n+    when 1\n+      day_diff_str = \"1 день\"\n+    when 2..4\n+      day_diff_str = day_diff.to_s + \" дня\"\n+    else\n+      day_diff_str = day_diff.to_s + \" дней\"\n+    end\n+    if month_diff.zero?\n+      \"На всё про всё у нас *#{day_diff_str}*\"\n+    elsif day_diff.zero?\n+      \"На всё про всё у нас *#{month_diff_str}*\"\n+    else \"На всё про всё у нас *#{month_diff_str}* и *#{day_diff_str}*\"\n+    end\n+  end\n+\n+  def self.is_correct?(date)\n+    if (date =~ /\\d\\d.\\d\\d.\\d\\d\\d\\d$/).nil? then status = false end\n+    time_ar = []\n+    if date.index(\".\").nil? then status = false end\n+    0.upto(2) do |i|\n+    time_ar[i] = date[0..date.index(\".\").to_i - 1]\n+    date = date[(date.index(\".\").to_i + 1)..date.size]\n+    end\n+    day = time_ar[0].to_i\n+    month = time_ar[1].to_i\n+    year = time_ar[2].to_i\n+    if day <= 0 || day > 31 || month <= 0 || month > 12 || (Time.now.year - year).abs > 1","path":"2016/MaksimShylau/2/lib/parse_date.rb","position":62,"original_position":62,"commit_id":"f600c1a05dcd2b79b06b0e880ff822b5e1c1d05c","original_commit_id":"f600c1a05dcd2b79b06b0e880ff822b5e1c1d05c","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 the return of the conditional for variable assignment and comparison.","created_at":"2016-10-31T15:36:36Z","updated_at":"2016-10-31T15:36:36Z","html_url":"https://github.com/rubyroidlabs/bsuir-courses/pull/483#discussion_r85764920","pull_request_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/483","_links":{"self":{"href":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/comments/85764920"},"html":{"href":"https://github.com/rubyroidlabs/bsuir-courses/pull/483#discussion_r85764920"},"pull_request":{"href":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/483"}}},"pull_request":{"url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/483","id":91533750,"html_url":"https://github.com/rubyroidlabs/bsuir-courses/pull/483","diff_url":"https://github.com/rubyroidlabs/bsuir-courses/pull/483.diff","patch_url":"https://github.com/rubyroidlabs/bsuir-courses/pull/483.patch","issue_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/issues/483","number":483,"state":"open","locked":false,"title":"Implementing homework 2 (Telegram bot, Level 1)","user":{"login":"storm2513","id":3923930,"avatar_url":"https://avatars.githubusercontent.com/u/3923930?v=3","gravatar_id":"","url":"https://api.github.com/users/storm2513","html_url":"https://github.com/storm2513","followers_url":"https://api.github.com/users/storm2513/followers","following_url":"https://api.github.com/users/storm2513/following{/other_user}","gists_url":"https://api.github.com/users/storm2513/gists{/gist_id}","starred_url":"https://api.github.com/users/storm2513/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/storm2513/subscriptions","organizations_url":"https://api.github.com/users/storm2513/orgs","repos_url":"https://api.github.com/users/storm2513/repos","events_url":"https://api.github.com/users/storm2513/events{/privacy}","received_events_url":"https://api.github.com/users/storm2513/received_events","type":"User","site_admin":false},"body":"## Фамилия Имя\n\nШилов Максим\n## Email\n\nstorm25132513@gmail.com\n## Номер домашнего задания\n\n2\n## Ссылка на видео с демо работы\n\nhttp://recordit.co/qQc98kPMgc\n## Комментарии\n\nСделал первый уровень.\nЗалил на Heroku.\nДанные хранятся в Redis.\nКод разбит на классы.\n@EasyLabBot\n","created_at":"2016-10-30T19:52:47Z","updated_at":"2016-10-31T15:36:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b2fe872a266fa88c89646759fc02813a21c15f58","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/483/commits","review_comments_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/483/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/483/comments","statuses_url":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/statuses/f600c1a05dcd2b79b06b0e880ff822b5e1c1d05c","head":{"label":"storm2513:homework-2","ref":"homework-2","sha":"f600c1a05dcd2b79b06b0e880ff822b5e1c1d05c","user":{"login":"storm2513","id":3923930,"avatar_url":"https://avatars.githubusercontent.com/u/3923930?v=3","gravatar_id":"","url":"https://api.github.com/users/storm2513","html_url":"https://github.com/storm2513","followers_url":"https://api.github.com/users/storm2513/followers","following_url":"https://api.github.com/users/storm2513/following{/other_user}","gists_url":"https://api.github.com/users/storm2513/gists{/gist_id}","starred_url":"https://api.github.com/users/storm2513/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/storm2513/subscriptions","organizations_url":"https://api.github.com/users/storm2513/orgs","repos_url":"https://api.github.com/users/storm2513/repos","events_url":"https://api.github.com/users/storm2513/events{/privacy}","received_events_url":"https://api.github.com/users/storm2513/received_events","type":"User","site_admin":false},"repo":{"id":71290735,"name":"bsuir-courses","full_name":"storm2513/bsuir-courses","owner":{"login":"storm2513","id":3923930,"avatar_url":"https://avatars.githubusercontent.com/u/3923930?v=3","gravatar_id":"","url":"https://api.github.com/users/storm2513","html_url":"https://github.com/storm2513","followers_url":"https://api.github.com/users/storm2513/followers","following_url":"https://api.github.com/users/storm2513/following{/other_user}","gists_url":"https://api.github.com/users/storm2513/gists{/gist_id}","starred_url":"https://api.github.com/users/storm2513/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/storm2513/subscriptions","organizations_url":"https://api.github.com/users/storm2513/orgs","repos_url":"https://api.github.com/users/storm2513/repos","events_url":"https://api.github.com/users/storm2513/events{/privacy}","received_events_url":"https://api.github.com/users/storm2513/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/storm2513/bsuir-courses","description":"This is common repository for all student to submit all their homeworks","fork":true,"url":"https://api.github.com/repos/storm2513/bsuir-courses","forks_url":"https://api.github.com/repos/storm2513/bsuir-courses/forks","keys_url":"https://api.github.com/repos/storm2513/bsuir-courses/keys{/key_id}","collaborators_url":"https://api.github.com/repos/storm2513/bsuir-courses/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/storm2513/bsuir-courses/teams","hooks_url":"https://api.github.com/repos/storm2513/bsuir-courses/hooks","issue_events_url":"https://api.github.com/repos/storm2513/bsuir-courses/issues/events{/number}","events_url":"https://api.github.com/repos/storm2513/bsuir-courses/events","assignees_url":"https://api.github.com/repos/storm2513/bsuir-courses/assignees{/user}","branches_url":"https://api.github.com/repos/storm2513/bsuir-courses/branches{/branch}","tags_url":"https://api.github.com/repos/storm2513/bsuir-courses/tags","blobs_url":"https://api.github.com/repos/storm2513/bsuir-courses/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/storm2513/bsuir-courses/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/storm2513/bsuir-courses/git/refs{/sha}","trees_url":"https://api.github.com/repos/storm2513/bsuir-courses/git/trees{/sha}","statuses_url":"https://api.github.com/repos/storm2513/bsuir-courses/statuses/{sha}","languages_url":"https://api.github.com/repos/storm2513/bsuir-courses/languages","stargazers_url":"https://api.github.com/repos/storm2513/bsuir-courses/stargazers","contributors_url":"https://api.github.com/repos/storm2513/bsuir-courses/contributors","subscribers_url":"https://api.github.com/repos/storm2513/bsuir-courses/subscribers","subscription_url":"https://api.github.com/repos/storm2513/bsuir-courses/subscription","commits_url":"https://api.github.com/repos/storm2513/bsuir-courses/commits{/sha}","git_commits_url":"https://api.github.com/repos/storm2513/bsuir-courses/git/commits{/sha}","comments_url":"https://api.github.com/repos/storm2513/bsuir-courses/comments{/number}","issue_comment_url":"https://api.github.com/repos/storm2513/bsuir-courses/issues/comments{/number}","contents_url":"https://api.github.com/repos/storm2513/bsuir-courses/contents/{+path}","compare_url":"https://api.github.com/repos/storm2513/bsuir-courses/compare/{base}...{head}","merges_url":"https://api.github.com/repos/storm2513/bsuir-courses/merges","archive_url":"https://api.github.com/repos/storm2513/bsuir-courses/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/storm2513/bsuir-courses/downloads","issues_url":"https://api.github.com/repos/storm2513/bsuir-courses/issues{/number}","pulls_url":"https://api.github.com/repos/storm2513/bsuir-courses/pulls{/number}","milestones_url":"https://api.github.com/repos/storm2513/bsuir-courses/milestones{/number}","notifications_url":"https://api.github.com/repos/storm2513/bsuir-courses/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/storm2513/bsuir-courses/labels{/name}","releases_url":"https://api.github.com/repos/storm2513/bsuir-courses/releases{/id}","deployments_url":"https://api.github.com/repos/storm2513/bsuir-courses/deployments","created_at":"2016-10-18T20:58:06Z","updated_at":"2016-10-18T20:58:09Z","pushed_at":"2016-10-31T15:36:00Z","git_url":"git://github.com/storm2513/bsuir-courses.git","ssh_url":"git@github.com:storm2513/bsuir-courses.git","clone_url":"https://github.com/storm2513/bsuir-courses.git","svn_url":"https://github.com/storm2513/bsuir-courses","homepage":null,"size":2137,"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":"1b9821cda9efc395caffc2717d302e2bf4f63dc7","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-10-26T21:04:00Z","pushed_at":"2016-10-31T15:36:01Z","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":7080,"stargazers_count":29,"watchers_count":29,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":174,"mirror_url":null,"open_issues_count":24,"forks":174,"open_issues":24,"watchers":29,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/483"},"html":{"href":"https://github.com/rubyroidlabs/bsuir-courses/pull/483"},"issue":{"href":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/issues/483"},"comments":{"href":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/issues/483/comments"},"review_comments":{"href":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/pulls/483/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/483/commits"},"statuses":{"href":"https://api.github.com/repos/rubyroidlabs/bsuir-courses/statuses/f600c1a05dcd2b79b06b0e880ff822b5e1c1d05c"}}}}
{"actor":{"display_login":"houndci-bot"}}