{"action":"created","comment":{"url":"https://api.github.com/repos/urfu-2018/javascript-task-3/pulls/comments/230563480","pull_request_review_id":171336573,"id":230563480,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMDU2MzQ4MA==","diff_hunk":"@@ -5,6 +5,153 @@\n  * Реализовано оба метода и tryLater\n  */\n const isStar = true;\n+const days = { 'ПН': 0, 'ВТ': 1, 'СР': 2, 'ЧТ': 3, 'ПТ': 4, 'СБ': 5, 'ВС': 6 };\n+const dayFromNumber = { 0: 'ПН', 1: 'ВТ', 2: 'СР', 3: 'ЧТ', 4: 'ПТ', 5: 'СБ', 6: 'ВС' };\n+const weekRegex = /^([а-яА-ЯёЁ]{2}) (\\d{2}):(\\d{2})\\+(\\d+)$/;\n+const dayRegex = /^(\\d{2}):(\\d{2})\\+(\\d+)$/;\n+const hoursInDay = 24;\n+const minutesInHour = 60;\n+const minutesInDay = hoursInDay * minutesInHour;\n+const lastAppropriateMoment = days['ЧТ'] * minutesInDay - 1;\n+const delay = 30;\n+\n+function getMinutesFromWeekStart(splitedDate, bankTimezone = 0) {\n+    let minutesFromWeekStart = 0;\n+    minutesFromWeekStart += days[splitedDate[1].toUpperCase()] * minutesInDay;\n+    minutesFromWeekStart +=\n+        (Number(splitedDate[2]) - Number(splitedDate[4]) + bankTimezone) * minutesInHour;\n+    minutesFromWeekStart += Number(splitedDate[3]);\n+\n+    return minutesFromWeekStart;\n+}\n+\n+function getMinutesFromDayStart(splitedDate, bankTimezone = 0) {\n+    let minutesFromDayStart = 0;\n+    minutesFromDayStart +=\n+        (Number(splitedDate[1]) - Number(splitedDate[3]) + bankTimezone) * minutesInHour;\n+    minutesFromDayStart += Number(splitedDate[2]);\n+\n+    return minutesFromDayStart;\n+}\n+\n+function getIntervalObject(from, to) {\n+    return { from, to };\n+}\n+\n+function toMinutesFromWeekStart(schedule, bankTimezone = 0) {\n+    return Object.values(schedule).map(robber =>\n+        robber\n+            .map(time => getIntervalObject(\n+                weekRegex.exec(time.from),\n+                weekRegex.exec(time.to)))\n+            .map(splited => getIntervalObject((getMinutesFromWeekStart(splited.from, bankTimezone)),\n+                (getMinutesFromWeekStart(splited.to, bankTimezone))))\n+            .sort((first, second) => first.from > second.from));\n+}\n+\n+function getFreeTimeIntervals(schedule) {\n+    let freeTimeIntervals = [];\n+    let times = [];\n+    schedule.forEach(robber => {\n+        robber.forEach(interval => {\n+            times.push({ from: true, value: interval.from });\n+            times.push({ from: false, value: interval.to });\n+        });\n+    });\n+    times = times.sort(function (first, second) {","path":"robbery.js","position":57,"original_position":57,"commit_id":"ae753bd121600b3e37e975ebe43609b92b5e5445","original_commit_id":"ae753bd121600b3e37e975ebe43609b92b5e5445","user":{"login":"Dotokoto","id":8973726,"node_id":"MDQ6VXNlcjg5NzM3MjY=","avatar_url":"https://avatars3.githubusercontent.com/u/8973726?v=4","gravatar_id":"","url":"https://api.github.com/users/Dotokoto","html_url":"https://github.com/Dotokoto","followers_url":"https://api.github.com/users/Dotokoto/followers","following_url":"https://api.github.com/users/Dotokoto/following{/other_user}","gists_url":"https://api.github.com/users/Dotokoto/gists{/gist_id}","starred_url":"https://api.github.com/users/Dotokoto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dotokoto/subscriptions","organizations_url":"https://api.github.com/users/Dotokoto/orgs","repos_url":"https://api.github.com/users/Dotokoto/repos","events_url":"https://api.github.com/users/Dotokoto/events{/privacy}","received_events_url":"https://api.github.com/users/Dotokoto/received_events","type":"User","site_admin":false},"body":"Можно переписать на стрелочную функцию","created_at":"2018-11-03T18:23:25Z","updated_at":"2018-11-03T18:30:24Z","html_url":"https://github.com/urfu-2018/javascript-task-3/pull/53#discussion_r230563480","pull_request_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/pulls/53","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/urfu-2018/javascript-task-3/pulls/comments/230563480"},"html":{"href":"https://github.com/urfu-2018/javascript-task-3/pull/53#discussion_r230563480"},"pull_request":{"href":"https://api.github.com/repos/urfu-2018/javascript-task-3/pulls/53"}}},"pull_request":{"url":"https://api.github.com/repos/urfu-2018/javascript-task-3/pulls/53","id":226712418,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI2NzEyNDE4","html_url":"https://github.com/urfu-2018/javascript-task-3/pull/53","diff_url":"https://github.com/urfu-2018/javascript-task-3/pull/53.diff","patch_url":"https://github.com/urfu-2018/javascript-task-3/pull/53.patch","issue_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/issues/53","number":53,"state":"open","locked":false,"title":"Плаксин Иван","user":{"login":"ZeroNetto","id":24540828,"node_id":"MDQ6VXNlcjI0NTQwODI4","avatar_url":"https://avatars0.githubusercontent.com/u/24540828?v=4","gravatar_id":"","url":"https://api.github.com/users/ZeroNetto","html_url":"https://github.com/ZeroNetto","followers_url":"https://api.github.com/users/ZeroNetto/followers","following_url":"https://api.github.com/users/ZeroNetto/following{/other_user}","gists_url":"https://api.github.com/users/ZeroNetto/gists{/gist_id}","starred_url":"https://api.github.com/users/ZeroNetto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZeroNetto/subscriptions","organizations_url":"https://api.github.com/users/ZeroNetto/orgs","repos_url":"https://api.github.com/users/ZeroNetto/repos","events_url":"https://api.github.com/users/ZeroNetto/events{/privacy}","received_events_url":"https://api.github.com/users/ZeroNetto/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-10-29T21:02:02Z","updated_at":"2018-11-03T18:30:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1bdbae3155ac2d2141165a45bc1be8043c6fbcf2","assignee":{"login":"Dotokoto","id":8973726,"node_id":"MDQ6VXNlcjg5NzM3MjY=","avatar_url":"https://avatars3.githubusercontent.com/u/8973726?v=4","gravatar_id":"","url":"https://api.github.com/users/Dotokoto","html_url":"https://github.com/Dotokoto","followers_url":"https://api.github.com/users/Dotokoto/followers","following_url":"https://api.github.com/users/Dotokoto/following{/other_user}","gists_url":"https://api.github.com/users/Dotokoto/gists{/gist_id}","starred_url":"https://api.github.com/users/Dotokoto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dotokoto/subscriptions","organizations_url":"https://api.github.com/users/Dotokoto/orgs","repos_url":"https://api.github.com/users/Dotokoto/repos","events_url":"https://api.github.com/users/Dotokoto/events{/privacy}","received_events_url":"https://api.github.com/users/Dotokoto/received_events","type":"User","site_admin":false},"assignees":[{"login":"Dotokoto","id":8973726,"node_id":"MDQ6VXNlcjg5NzM3MjY=","avatar_url":"https://avatars3.githubusercontent.com/u/8973726?v=4","gravatar_id":"","url":"https://api.github.com/users/Dotokoto","html_url":"https://github.com/Dotokoto","followers_url":"https://api.github.com/users/Dotokoto/followers","following_url":"https://api.github.com/users/Dotokoto/following{/other_user}","gists_url":"https://api.github.com/users/Dotokoto/gists{/gist_id}","starred_url":"https://api.github.com/users/Dotokoto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dotokoto/subscriptions","organizations_url":"https://api.github.com/users/Dotokoto/orgs","repos_url":"https://api.github.com/users/Dotokoto/repos","events_url":"https://api.github.com/users/Dotokoto/events{/privacy}","received_events_url":"https://api.github.com/users/Dotokoto/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/pulls/53/commits","review_comments_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/pulls/53/comments","review_comment_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/pulls/comments{/number}","comments_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/issues/53/comments","statuses_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/statuses/ae753bd121600b3e37e975ebe43609b92b5e5445","head":{"label":"ZeroNetto:master","ref":"master","sha":"ae753bd121600b3e37e975ebe43609b92b5e5445","user":{"login":"ZeroNetto","id":24540828,"node_id":"MDQ6VXNlcjI0NTQwODI4","avatar_url":"https://avatars0.githubusercontent.com/u/24540828?v=4","gravatar_id":"","url":"https://api.github.com/users/ZeroNetto","html_url":"https://github.com/ZeroNetto","followers_url":"https://api.github.com/users/ZeroNetto/followers","following_url":"https://api.github.com/users/ZeroNetto/following{/other_user}","gists_url":"https://api.github.com/users/ZeroNetto/gists{/gist_id}","starred_url":"https://api.github.com/users/ZeroNetto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZeroNetto/subscriptions","organizations_url":"https://api.github.com/users/ZeroNetto/orgs","repos_url":"https://api.github.com/users/ZeroNetto/repos","events_url":"https://api.github.com/users/ZeroNetto/events{/privacy}","received_events_url":"https://api.github.com/users/ZeroNetto/received_events","type":"User","site_admin":false},"repo":{"id":154398723,"node_id":"MDEwOlJlcG9zaXRvcnkxNTQzOTg3MjM=","name":"javascript-task-3","full_name":"ZeroNetto/javascript-task-3","private":false,"owner":{"login":"ZeroNetto","id":24540828,"node_id":"MDQ6VXNlcjI0NTQwODI4","avatar_url":"https://avatars0.githubusercontent.com/u/24540828?v=4","gravatar_id":"","url":"https://api.github.com/users/ZeroNetto","html_url":"https://github.com/ZeroNetto","followers_url":"https://api.github.com/users/ZeroNetto/followers","following_url":"https://api.github.com/users/ZeroNetto/following{/other_user}","gists_url":"https://api.github.com/users/ZeroNetto/gists{/gist_id}","starred_url":"https://api.github.com/users/ZeroNetto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZeroNetto/subscriptions","organizations_url":"https://api.github.com/users/ZeroNetto/orgs","repos_url":"https://api.github.com/users/ZeroNetto/repos","events_url":"https://api.github.com/users/ZeroNetto/events{/privacy}","received_events_url":"https://api.github.com/users/ZeroNetto/received_events","type":"User","site_admin":false},"html_url":"https://github.com/ZeroNetto/javascript-task-3","description":"Задача «0b11 друзей Аркадия»","fork":true,"url":"https://api.github.com/repos/ZeroNetto/javascript-task-3","forks_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/forks","keys_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/teams","hooks_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/hooks","issue_events_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/issues/events{/number}","events_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/events","assignees_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/assignees{/user}","branches_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/branches{/branch}","tags_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/tags","blobs_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/git/refs{/sha}","trees_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/statuses/{sha}","languages_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/languages","stargazers_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/stargazers","contributors_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/contributors","subscribers_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/subscribers","subscription_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/subscription","commits_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/commits{/sha}","git_commits_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/git/commits{/sha}","comments_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/comments{/number}","issue_comment_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/issues/comments{/number}","contents_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/contents/{+path}","compare_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/merges","archive_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/downloads","issues_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/issues{/number}","pulls_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/pulls{/number}","milestones_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/milestones{/number}","notifications_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/labels{/name}","releases_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/releases{/id}","deployments_url":"https://api.github.com/repos/ZeroNetto/javascript-task-3/deployments","created_at":"2018-10-23T21:24:31Z","updated_at":"2018-10-29T22:42:34Z","pushed_at":"2018-10-29T22:42:32Z","git_url":"git://github.com/ZeroNetto/javascript-task-3.git","ssh_url":"git@github.com:ZeroNetto/javascript-task-3.git","clone_url":"https://github.com/ZeroNetto/javascript-task-3.git","svn_url":"https://github.com/ZeroNetto/javascript-task-3","homepage":null,"size":29,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"urfu-2018:master","ref":"master","sha":"e0945d9ddda85928c97dacdf1d9ab9dab532881b","user":{"login":"urfu-2018","id":43127233,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQzMTI3MjMz","avatar_url":"https://avatars0.githubusercontent.com/u/43127233?v=4","gravatar_id":"","url":"https://api.github.com/users/urfu-2018","html_url":"https://github.com/urfu-2018","followers_url":"https://api.github.com/users/urfu-2018/followers","following_url":"https://api.github.com/users/urfu-2018/following{/other_user}","gists_url":"https://api.github.com/users/urfu-2018/gists{/gist_id}","starred_url":"https://api.github.com/users/urfu-2018/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urfu-2018/subscriptions","organizations_url":"https://api.github.com/users/urfu-2018/orgs","repos_url":"https://api.github.com/users/urfu-2018/repos","events_url":"https://api.github.com/users/urfu-2018/events{/privacy}","received_events_url":"https://api.github.com/users/urfu-2018/received_events","type":"Organization","site_admin":false},"repo":{"id":154332622,"node_id":"MDEwOlJlcG9zaXRvcnkxNTQzMzI2MjI=","name":"javascript-task-3","full_name":"urfu-2018/javascript-task-3","private":false,"owner":{"login":"urfu-2018","id":43127233,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQzMTI3MjMz","avatar_url":"https://avatars0.githubusercontent.com/u/43127233?v=4","gravatar_id":"","url":"https://api.github.com/users/urfu-2018","html_url":"https://github.com/urfu-2018","followers_url":"https://api.github.com/users/urfu-2018/followers","following_url":"https://api.github.com/users/urfu-2018/following{/other_user}","gists_url":"https://api.github.com/users/urfu-2018/gists{/gist_id}","starred_url":"https://api.github.com/users/urfu-2018/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urfu-2018/subscriptions","organizations_url":"https://api.github.com/users/urfu-2018/orgs","repos_url":"https://api.github.com/users/urfu-2018/repos","events_url":"https://api.github.com/users/urfu-2018/events{/privacy}","received_events_url":"https://api.github.com/users/urfu-2018/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/urfu-2018/javascript-task-3","description":"Задача «0b11 друзей Аркадия»","fork":false,"url":"https://api.github.com/repos/urfu-2018/javascript-task-3","forks_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/forks","keys_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/teams","hooks_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/hooks","issue_events_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/issues/events{/number}","events_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/events","assignees_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/assignees{/user}","branches_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/branches{/branch}","tags_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/tags","blobs_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/git/refs{/sha}","trees_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/statuses/{sha}","languages_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/languages","stargazers_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/stargazers","contributors_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/contributors","subscribers_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/subscribers","subscription_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/subscription","commits_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/commits{/sha}","git_commits_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/git/commits{/sha}","comments_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/comments{/number}","issue_comment_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/issues/comments{/number}","contents_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/contents/{+path}","compare_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/merges","archive_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/downloads","issues_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/issues{/number}","pulls_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/pulls{/number}","milestones_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/milestones{/number}","notifications_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/labels{/name}","releases_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/releases{/id}","deployments_url":"https://api.github.com/repos/urfu-2018/javascript-task-3/deployments","created_at":"2018-10-23T13:26:25Z","updated_at":"2018-10-23T13:34:04Z","pushed_at":"2018-11-03T16:28:42Z","git_url":"git://github.com/urfu-2018/javascript-task-3.git","ssh_url":"git@github.com:urfu-2018/javascript-task-3.git","clone_url":"https://github.com/urfu-2018/javascript-task-3.git","svn_url":"https://github.com/urfu-2018/javascript-task-3","homepage":null,"size":15,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":107,"mirror_url":null,"archived":false,"open_issues_count":54,"license":null,"forks":107,"open_issues":54,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/urfu-2018/javascript-task-3/pulls/53"},"html":{"href":"https://github.com/urfu-2018/javascript-task-3/pull/53"},"issue":{"href":"https://api.github.com/repos/urfu-2018/javascript-task-3/issues/53"},"comments":{"href":"https://api.github.com/repos/urfu-2018/javascript-task-3/issues/53/comments"},"review_comments":{"href":"https://api.github.com/repos/urfu-2018/javascript-task-3/pulls/53/comments"},"review_comment":{"href":"https://api.github.com/repos/urfu-2018/javascript-task-3/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/urfu-2018/javascript-task-3/pulls/53/commits"},"statuses":{"href":"https://api.github.com/repos/urfu-2018/javascript-task-3/statuses/ae753bd121600b3e37e975ebe43609b92b5e5445"}},"author_association":"NONE"}}
{"actor":{"display_login":"Dotokoto"}}