{"action":"created","comment":{"url":"https://api.github.com/repos/maratonime/simone/pulls/comments/187488577","pull_request_review_id":119281574,"id":187488577,"diff_hunk":"@@ -0,0 +1,61 @@\n+// @flow\n+import { JSDOM } from 'jsdom';\n+import type { Contest } from '../../types';\n+import type { State } from '../../types';\n+\n+// TODO: row should be an HTMLTableRowElement, however flow has an issue\n+// concerning that. See https://github.com/facebook/flow/issues/6264\n+function contestDataFrom(row: any): Contest {\n+  const cells: HTMLCollection<HTMLTableCellElement> = row.cells;\n+\n+  let code: string = cells[0].textContent;\n+  let name: string = cells[1].children[0].textContent;\n+  let url: string = 'https://www.codechef.com/' + code;\n+  let startTime: Date = new Date(cells[2].dataset['starttime']);\n+  let endTime: Date = new Date(cells[3].dataset['endtime']);\n+  let duration: number = (endTime.getTime() - startTime.getTime()) / 1000;\n+\n+  let state: State;\n+  let now = new Date();\n+  if(startTime > now) state = 'UPCOMING';\n+  else if(endTime <= now) state = 'FINISHED';\n+  else state = 'RUNNING';\n+\n+  return {\n+    name: name,\n+    code: code,\n+    judge: 'codechef',\n+    startTime: startTime,\n+    duration: duration,\n+    state: state,\n+    url: url\n+  };\n+}\n+\n+export function getContests(): Promise<Array<Contest>> {\n+  return new Promise((resolve: Function, reject: Function) => {\n+    // dom is a JSDOM, which is a third-party library that was not built with Flow\n+    JSDOM.fromURL('https://www.codechef.com/contests').then((dom: any): void => {\n+      try {\n+        const document: Document = dom.window.document;\n+\n+        // This should be a NodeList<HTMLTableElement>, but querySelectorAll returns a\n+        // NodeList<HTMLElement>, which does not have the property tBodies, used below.\n+        const contestsTables: NodeList<any> = document.querySelectorAll('table.dataTable');","path":"src/judges/codechef/getContests.js","position":44,"original_position":44,"commit_id":"110b70ab68a7d7544502fea765ee2cf157ca3598","original_commit_id":"110b70ab68a7d7544502fea765ee2cf157ca3598","user":{"login":"gabrielrussoc","id":12474185,"avatar_url":"https://avatars2.githubusercontent.com/u/12474185?v=4","gravatar_id":"","url":"https://api.github.com/users/gabrielrussoc","html_url":"https://github.com/gabrielrussoc","followers_url":"https://api.github.com/users/gabrielrussoc/followers","following_url":"https://api.github.com/users/gabrielrussoc/following{/other_user}","gists_url":"https://api.github.com/users/gabrielrussoc/gists{/gist_id}","starred_url":"https://api.github.com/users/gabrielrussoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabrielrussoc/subscriptions","organizations_url":"https://api.github.com/users/gabrielrussoc/orgs","repos_url":"https://api.github.com/users/gabrielrussoc/repos","events_url":"https://api.github.com/users/gabrielrussoc/events{/privacy}","received_events_url":"https://api.github.com/users/gabrielrussoc/received_events","type":"User","site_admin":false},"body":"The code you suggested does not work. I don't know what to do.","created_at":"2018-05-10T23:37:07Z","updated_at":"2018-05-10T23:37:07Z","html_url":"https://github.com/maratonime/simone/pull/24#discussion_r187488577","pull_request_url":"https://api.github.com/repos/maratonime/simone/pulls/24","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/maratonime/simone/pulls/comments/187488577"},"html":{"href":"https://github.com/maratonime/simone/pull/24#discussion_r187488577"},"pull_request":{"href":"https://api.github.com/repos/maratonime/simone/pulls/24"}},"in_reply_to_id":186829662},"pull_request":{"url":"https://api.github.com/repos/maratonime/simone/pulls/24","id":186698619,"html_url":"https://github.com/maratonime/simone/pull/24","diff_url":"https://github.com/maratonime/simone/pull/24.diff","patch_url":"https://github.com/maratonime/simone/pull/24.patch","issue_url":"https://api.github.com/repos/maratonime/simone/issues/24","number":24,"state":"open","locked":false,"title":"Codechef fetcher","user":{"login":"gabrielrussoc","id":12474185,"avatar_url":"https://avatars2.githubusercontent.com/u/12474185?v=4","gravatar_id":"","url":"https://api.github.com/users/gabrielrussoc","html_url":"https://github.com/gabrielrussoc","followers_url":"https://api.github.com/users/gabrielrussoc/followers","following_url":"https://api.github.com/users/gabrielrussoc/following{/other_user}","gists_url":"https://api.github.com/users/gabrielrussoc/gists{/gist_id}","starred_url":"https://api.github.com/users/gabrielrussoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabrielrussoc/subscriptions","organizations_url":"https://api.github.com/users/gabrielrussoc/orgs","repos_url":"https://api.github.com/users/gabrielrussoc/repos","events_url":"https://api.github.com/users/gabrielrussoc/events{/privacy}","received_events_url":"https://api.github.com/users/gabrielrussoc/received_events","type":"User","site_admin":false},"body":"closes #4 ","created_at":"2018-05-08T17:09:42Z","updated_at":"2018-05-10T23:37:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4a1f6598173a634fadb0935b371fb1ea901a651b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/maratonime/simone/pulls/24/commits","review_comments_url":"https://api.github.com/repos/maratonime/simone/pulls/24/comments","review_comment_url":"https://api.github.com/repos/maratonime/simone/pulls/comments{/number}","comments_url":"https://api.github.com/repos/maratonime/simone/issues/24/comments","statuses_url":"https://api.github.com/repos/maratonime/simone/statuses/110b70ab68a7d7544502fea765ee2cf157ca3598","head":{"label":"maratonime:codechef","ref":"codechef","sha":"110b70ab68a7d7544502fea765ee2cf157ca3598","user":{"login":"maratonime","id":31360687,"avatar_url":"https://avatars2.githubusercontent.com/u/31360687?v=4","gravatar_id":"","url":"https://api.github.com/users/maratonime","html_url":"https://github.com/maratonime","followers_url":"https://api.github.com/users/maratonime/followers","following_url":"https://api.github.com/users/maratonime/following{/other_user}","gists_url":"https://api.github.com/users/maratonime/gists{/gist_id}","starred_url":"https://api.github.com/users/maratonime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maratonime/subscriptions","organizations_url":"https://api.github.com/users/maratonime/orgs","repos_url":"https://api.github.com/users/maratonime/repos","events_url":"https://api.github.com/users/maratonime/events{/privacy}","received_events_url":"https://api.github.com/users/maratonime/received_events","type":"Organization","site_admin":false},"repo":{"id":131901086,"name":"simone","full_name":"maratonime/simone","owner":{"login":"maratonime","id":31360687,"avatar_url":"https://avatars2.githubusercontent.com/u/31360687?v=4","gravatar_id":"","url":"https://api.github.com/users/maratonime","html_url":"https://github.com/maratonime","followers_url":"https://api.github.com/users/maratonime/followers","following_url":"https://api.github.com/users/maratonime/following{/other_user}","gists_url":"https://api.github.com/users/maratonime/gists{/gist_id}","starred_url":"https://api.github.com/users/maratonime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maratonime/subscriptions","organizations_url":"https://api.github.com/users/maratonime/orgs","repos_url":"https://api.github.com/users/maratonime/repos","events_url":"https://api.github.com/users/maratonime/events{/privacy}","received_events_url":"https://api.github.com/users/maratonime/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/maratonime/simone","description":"Standardized Online Judge API","fork":false,"url":"https://api.github.com/repos/maratonime/simone","forks_url":"https://api.github.com/repos/maratonime/simone/forks","keys_url":"https://api.github.com/repos/maratonime/simone/keys{/key_id}","collaborators_url":"https://api.github.com/repos/maratonime/simone/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/maratonime/simone/teams","hooks_url":"https://api.github.com/repos/maratonime/simone/hooks","issue_events_url":"https://api.github.com/repos/maratonime/simone/issues/events{/number}","events_url":"https://api.github.com/repos/maratonime/simone/events","assignees_url":"https://api.github.com/repos/maratonime/simone/assignees{/user}","branches_url":"https://api.github.com/repos/maratonime/simone/branches{/branch}","tags_url":"https://api.github.com/repos/maratonime/simone/tags","blobs_url":"https://api.github.com/repos/maratonime/simone/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/maratonime/simone/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/maratonime/simone/git/refs{/sha}","trees_url":"https://api.github.com/repos/maratonime/simone/git/trees{/sha}","statuses_url":"https://api.github.com/repos/maratonime/simone/statuses/{sha}","languages_url":"https://api.github.com/repos/maratonime/simone/languages","stargazers_url":"https://api.github.com/repos/maratonime/simone/stargazers","contributors_url":"https://api.github.com/repos/maratonime/simone/contributors","subscribers_url":"https://api.github.com/repos/maratonime/simone/subscribers","subscription_url":"https://api.github.com/repos/maratonime/simone/subscription","commits_url":"https://api.github.com/repos/maratonime/simone/commits{/sha}","git_commits_url":"https://api.github.com/repos/maratonime/simone/git/commits{/sha}","comments_url":"https://api.github.com/repos/maratonime/simone/comments{/number}","issue_comment_url":"https://api.github.com/repos/maratonime/simone/issues/comments{/number}","contents_url":"https://api.github.com/repos/maratonime/simone/contents/{+path}","compare_url":"https://api.github.com/repos/maratonime/simone/compare/{base}...{head}","merges_url":"https://api.github.com/repos/maratonime/simone/merges","archive_url":"https://api.github.com/repos/maratonime/simone/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/maratonime/simone/downloads","issues_url":"https://api.github.com/repos/maratonime/simone/issues{/number}","pulls_url":"https://api.github.com/repos/maratonime/simone/pulls{/number}","milestones_url":"https://api.github.com/repos/maratonime/simone/milestones{/number}","notifications_url":"https://api.github.com/repos/maratonime/simone/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/maratonime/simone/labels{/name}","releases_url":"https://api.github.com/repos/maratonime/simone/releases{/id}","deployments_url":"https://api.github.com/repos/maratonime/simone/deployments","created_at":"2018-05-02T20:12:35Z","updated_at":"2018-05-08T20:32:15Z","pushed_at":"2018-05-10T21:28:43Z","git_url":"git://github.com/maratonime/simone.git","ssh_url":"git@github.com:maratonime/simone.git","clone_url":"https://github.com/maratonime/simone.git","svn_url":"https://github.com/maratonime/simone","homepage":null,"size":51,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":13,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":1,"open_issues":13,"watchers":2,"default_branch":"master"}},"base":{"label":"maratonime:master","ref":"master","sha":"7ff4bf52069df497d5ad43fc121d9c5cc0e3f92e","user":{"login":"maratonime","id":31360687,"avatar_url":"https://avatars2.githubusercontent.com/u/31360687?v=4","gravatar_id":"","url":"https://api.github.com/users/maratonime","html_url":"https://github.com/maratonime","followers_url":"https://api.github.com/users/maratonime/followers","following_url":"https://api.github.com/users/maratonime/following{/other_user}","gists_url":"https://api.github.com/users/maratonime/gists{/gist_id}","starred_url":"https://api.github.com/users/maratonime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maratonime/subscriptions","organizations_url":"https://api.github.com/users/maratonime/orgs","repos_url":"https://api.github.com/users/maratonime/repos","events_url":"https://api.github.com/users/maratonime/events{/privacy}","received_events_url":"https://api.github.com/users/maratonime/received_events","type":"Organization","site_admin":false},"repo":{"id":131901086,"name":"simone","full_name":"maratonime/simone","owner":{"login":"maratonime","id":31360687,"avatar_url":"https://avatars2.githubusercontent.com/u/31360687?v=4","gravatar_id":"","url":"https://api.github.com/users/maratonime","html_url":"https://github.com/maratonime","followers_url":"https://api.github.com/users/maratonime/followers","following_url":"https://api.github.com/users/maratonime/following{/other_user}","gists_url":"https://api.github.com/users/maratonime/gists{/gist_id}","starred_url":"https://api.github.com/users/maratonime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maratonime/subscriptions","organizations_url":"https://api.github.com/users/maratonime/orgs","repos_url":"https://api.github.com/users/maratonime/repos","events_url":"https://api.github.com/users/maratonime/events{/privacy}","received_events_url":"https://api.github.com/users/maratonime/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/maratonime/simone","description":"Standardized Online Judge API","fork":false,"url":"https://api.github.com/repos/maratonime/simone","forks_url":"https://api.github.com/repos/maratonime/simone/forks","keys_url":"https://api.github.com/repos/maratonime/simone/keys{/key_id}","collaborators_url":"https://api.github.com/repos/maratonime/simone/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/maratonime/simone/teams","hooks_url":"https://api.github.com/repos/maratonime/simone/hooks","issue_events_url":"https://api.github.com/repos/maratonime/simone/issues/events{/number}","events_url":"https://api.github.com/repos/maratonime/simone/events","assignees_url":"https://api.github.com/repos/maratonime/simone/assignees{/user}","branches_url":"https://api.github.com/repos/maratonime/simone/branches{/branch}","tags_url":"https://api.github.com/repos/maratonime/simone/tags","blobs_url":"https://api.github.com/repos/maratonime/simone/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/maratonime/simone/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/maratonime/simone/git/refs{/sha}","trees_url":"https://api.github.com/repos/maratonime/simone/git/trees{/sha}","statuses_url":"https://api.github.com/repos/maratonime/simone/statuses/{sha}","languages_url":"https://api.github.com/repos/maratonime/simone/languages","stargazers_url":"https://api.github.com/repos/maratonime/simone/stargazers","contributors_url":"https://api.github.com/repos/maratonime/simone/contributors","subscribers_url":"https://api.github.com/repos/maratonime/simone/subscribers","subscription_url":"https://api.github.com/repos/maratonime/simone/subscription","commits_url":"https://api.github.com/repos/maratonime/simone/commits{/sha}","git_commits_url":"https://api.github.com/repos/maratonime/simone/git/commits{/sha}","comments_url":"https://api.github.com/repos/maratonime/simone/comments{/number}","issue_comment_url":"https://api.github.com/repos/maratonime/simone/issues/comments{/number}","contents_url":"https://api.github.com/repos/maratonime/simone/contents/{+path}","compare_url":"https://api.github.com/repos/maratonime/simone/compare/{base}...{head}","merges_url":"https://api.github.com/repos/maratonime/simone/merges","archive_url":"https://api.github.com/repos/maratonime/simone/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/maratonime/simone/downloads","issues_url":"https://api.github.com/repos/maratonime/simone/issues{/number}","pulls_url":"https://api.github.com/repos/maratonime/simone/pulls{/number}","milestones_url":"https://api.github.com/repos/maratonime/simone/milestones{/number}","notifications_url":"https://api.github.com/repos/maratonime/simone/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/maratonime/simone/labels{/name}","releases_url":"https://api.github.com/repos/maratonime/simone/releases{/id}","deployments_url":"https://api.github.com/repos/maratonime/simone/deployments","created_at":"2018-05-02T20:12:35Z","updated_at":"2018-05-08T20:32:15Z","pushed_at":"2018-05-10T21:28:43Z","git_url":"git://github.com/maratonime/simone.git","ssh_url":"git@github.com:maratonime/simone.git","clone_url":"https://github.com/maratonime/simone.git","svn_url":"https://github.com/maratonime/simone","homepage":null,"size":51,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":13,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":1,"open_issues":13,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/maratonime/simone/pulls/24"},"html":{"href":"https://github.com/maratonime/simone/pull/24"},"issue":{"href":"https://api.github.com/repos/maratonime/simone/issues/24"},"comments":{"href":"https://api.github.com/repos/maratonime/simone/issues/24/comments"},"review_comments":{"href":"https://api.github.com/repos/maratonime/simone/pulls/24/comments"},"review_comment":{"href":"https://api.github.com/repos/maratonime/simone/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/maratonime/simone/pulls/24/commits"},"statuses":{"href":"https://api.github.com/repos/maratonime/simone/statuses/110b70ab68a7d7544502fea765ee2cf157ca3598"}},"author_association":"OWNER"}}
{"actor":{"display_login":"gabrielrussoc"}}