{"action":"created","comment":{"url":"https://api.github.com/repos/josemigallas/tennisWebApp/pulls/comments/44435243","id":44435243,"diff_hunk":"@@ -0,0 +1,121 @@\n+import $ from \"jquery\";\n+import * as tournamentAlerts from \"./tournamentAlerts\";\n+\n+var tournament;\n+\n+export function init(t) {\n+    tournament = t;\n+\n+    generateHTMLTournamentBracket();\n+}\n+\n+function generateHTMLTournamentBracket() {\n+    cleanBracket();\n+    divideBracketVerticallyInRounds(tournament.getRounds());\n+    appendAllMatchesWithSpacesToHtml(tournament.matches);\n+    bindClickEventOnWinButtons(tournament.matches);\n+}\n+\n+function cleanBracket() {\n+    $(\"#tournamentBracket\").empty();\n+}\n+\n+function divideBracketVerticallyInRounds(rounds) {\n+    var colSize = 100/rounds;\n+\n+    for (var r = 1; r <= rounds; r++) {\n+        $(\"#tournamentBracket\").append(\n+            `<div class=\"col-xs-1\" id=\"round${r}\" style=\"width: ${colSize}%; padding: 0;\"></div>`\n+        );\n+    }\n+}\n+\n+function appendAllMatchesWithSpacesToHtml() {\n+    tournament.matches.forEach( function(match, i, matches) {\n+        if (match.round > 1) {\n+            appendTransparenSpacesToHtml(match.round, matches[i-1].round);\n+        }\n+        appendMatchHtmlPanel(match, i);\n+    });\n+}\n+\n+function appendTransparenSpacesToHtml(round, lastRound) {\n+    $(`#round${round}`).append(\n+        generateHtmlTransparentSpaces(round, lastRound)\n+    );\n+}\n+\n+function generateHtmlTransparentSpaces(round, lastRound) {\n+    var space = \"\";\n+\n+    if (round !== lastRound) {\n+        if (round > 1) {\n+            space += `<div class=\"panel panel-default box-bracket-ghost-med\"></div>`;\n+        }\n+        if (round > 2) {\n+            space += `<div class=\"panel panel-default box-bracket-ghost\"></div>`.repeat(round - 2);\n+        }\n+\n+    } else {\n+        space += `<div class=\"panel panel-default box-bracket-ghost\"></div>`;\n+    }\n+\n+    return space;\n+}\n+\n+function appendMatchHtmlPanel(match, i) {\n+    $(`#round${match.round}`).append(\n+        generateMatchHtmlPanel(match, i)\n+    );\n+}\n+\n+function generateMatchHtmlPanel(match, i) {\n+    var html = `<div class=\"panel panel-default box-bracket\"><div>`;","path":"app/tournamentBusiness/tournamentProgress.js","position":73,"original_position":73,"commit_id":"53e3551a797bb56d210e84a55da733aba7789b44","original_commit_id":"53e3551a797bb56d210e84a55da733aba7789b44","user":{"login":"pablonete","id":579705,"avatar_url":"https://avatars.githubusercontent.com/u/579705?v=3","gravatar_id":"","url":"https://api.github.com/users/pablonete","html_url":"https://github.com/pablonete","followers_url":"https://api.github.com/users/pablonete/followers","following_url":"https://api.github.com/users/pablonete/following{/other_user}","gists_url":"https://api.github.com/users/pablonete/gists{/gist_id}","starred_url":"https://api.github.com/users/pablonete/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pablonete/subscriptions","organizations_url":"https://api.github.com/users/pablonete/orgs","repos_url":"https://api.github.com/users/pablonete/repos","events_url":"https://api.github.com/users/pablonete/events{/privacy}","received_events_url":"https://api.github.com/users/pablonete/received_events","type":"User","site_admin":false},"body":"What's i? Name better.\r\nAnd can you avoid it?","created_at":"2015-11-10T17:17:46Z","updated_at":"2015-11-10T17:17:46Z","html_url":"https://github.com/josemigallas/tennisWebApp/pull/2#discussion_r44435243","pull_request_url":"https://api.github.com/repos/josemigallas/tennisWebApp/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/josemigallas/tennisWebApp/pulls/comments/44435243"},"html":{"href":"https://github.com/josemigallas/tennisWebApp/pull/2#discussion_r44435243"},"pull_request":{"href":"https://api.github.com/repos/josemigallas/tennisWebApp/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/josemigallas/tennisWebApp/pulls/2","id":49455963,"html_url":"https://github.com/josemigallas/tennisWebApp/pull/2","diff_url":"https://github.com/josemigallas/tennisWebApp/pull/2.diff","patch_url":"https://github.com/josemigallas/tennisWebApp/pull/2.patch","issue_url":"https://api.github.com/repos/josemigallas/tennisWebApp/issues/2","number":2,"state":"open","locked":false,"title":"Layout","user":{"login":"josemigallas","id":11672286,"avatar_url":"https://avatars.githubusercontent.com/u/11672286?v=3","gravatar_id":"","url":"https://api.github.com/users/josemigallas","html_url":"https://github.com/josemigallas","followers_url":"https://api.github.com/users/josemigallas/followers","following_url":"https://api.github.com/users/josemigallas/following{/other_user}","gists_url":"https://api.github.com/users/josemigallas/gists{/gist_id}","starred_url":"https://api.github.com/users/josemigallas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josemigallas/subscriptions","organizations_url":"https://api.github.com/users/josemigallas/orgs","repos_url":"https://api.github.com/users/josemigallas/repos","events_url":"https://api.github.com/users/josemigallas/events{/privacy}","received_events_url":"https://api.github.com/users/josemigallas/received_events","type":"User","site_admin":false},"body":"App implementation has been integrated into layout, allowing to generate a tournament by means of some forms, button and a table.","created_at":"2015-11-02T16:52:31Z","updated_at":"2015-11-10T17:17:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"841b7cc201269f542c64c400a1e8c91c0b98ee7e","assignee":{"login":"pablonete","id":579705,"avatar_url":"https://avatars.githubusercontent.com/u/579705?v=3","gravatar_id":"","url":"https://api.github.com/users/pablonete","html_url":"https://github.com/pablonete","followers_url":"https://api.github.com/users/pablonete/followers","following_url":"https://api.github.com/users/pablonete/following{/other_user}","gists_url":"https://api.github.com/users/pablonete/gists{/gist_id}","starred_url":"https://api.github.com/users/pablonete/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pablonete/subscriptions","organizations_url":"https://api.github.com/users/pablonete/orgs","repos_url":"https://api.github.com/users/pablonete/repos","events_url":"https://api.github.com/users/pablonete/events{/privacy}","received_events_url":"https://api.github.com/users/pablonete/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/josemigallas/tennisWebApp/pulls/2/commits","review_comments_url":"https://api.github.com/repos/josemigallas/tennisWebApp/pulls/2/comments","review_comment_url":"https://api.github.com/repos/josemigallas/tennisWebApp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/josemigallas/tennisWebApp/issues/2/comments","statuses_url":"https://api.github.com/repos/josemigallas/tennisWebApp/statuses/53e3551a797bb56d210e84a55da733aba7789b44","head":{"label":"josemigallas:layout","ref":"layout","sha":"53e3551a797bb56d210e84a55da733aba7789b44","user":{"login":"josemigallas","id":11672286,"avatar_url":"https://avatars.githubusercontent.com/u/11672286?v=3","gravatar_id":"","url":"https://api.github.com/users/josemigallas","html_url":"https://github.com/josemigallas","followers_url":"https://api.github.com/users/josemigallas/followers","following_url":"https://api.github.com/users/josemigallas/following{/other_user}","gists_url":"https://api.github.com/users/josemigallas/gists{/gist_id}","starred_url":"https://api.github.com/users/josemigallas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josemigallas/subscriptions","organizations_url":"https://api.github.com/users/josemigallas/orgs","repos_url":"https://api.github.com/users/josemigallas/repos","events_url":"https://api.github.com/users/josemigallas/events{/privacy}","received_events_url":"https://api.github.com/users/josemigallas/received_events","type":"User","site_admin":false},"repo":{"id":45120652,"name":"tennisWebApp","full_name":"josemigallas/tennisWebApp","owner":{"login":"josemigallas","id":11672286,"avatar_url":"https://avatars.githubusercontent.com/u/11672286?v=3","gravatar_id":"","url":"https://api.github.com/users/josemigallas","html_url":"https://github.com/josemigallas","followers_url":"https://api.github.com/users/josemigallas/followers","following_url":"https://api.github.com/users/josemigallas/following{/other_user}","gists_url":"https://api.github.com/users/josemigallas/gists{/gist_id}","starred_url":"https://api.github.com/users/josemigallas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josemigallas/subscriptions","organizations_url":"https://api.github.com/users/josemigallas/orgs","repos_url":"https://api.github.com/users/josemigallas/repos","events_url":"https://api.github.com/users/josemigallas/events{/privacy}","received_events_url":"https://api.github.com/users/josemigallas/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/josemigallas/tennisWebApp","description":"","fork":false,"url":"https://api.github.com/repos/josemigallas/tennisWebApp","forks_url":"https://api.github.com/repos/josemigallas/tennisWebApp/forks","keys_url":"https://api.github.com/repos/josemigallas/tennisWebApp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/josemigallas/tennisWebApp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/josemigallas/tennisWebApp/teams","hooks_url":"https://api.github.com/repos/josemigallas/tennisWebApp/hooks","issue_events_url":"https://api.github.com/repos/josemigallas/tennisWebApp/issues/events{/number}","events_url":"https://api.github.com/repos/josemigallas/tennisWebApp/events","assignees_url":"https://api.github.com/repos/josemigallas/tennisWebApp/assignees{/user}","branches_url":"https://api.github.com/repos/josemigallas/tennisWebApp/branches{/branch}","tags_url":"https://api.github.com/repos/josemigallas/tennisWebApp/tags","blobs_url":"https://api.github.com/repos/josemigallas/tennisWebApp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/josemigallas/tennisWebApp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/josemigallas/tennisWebApp/git/refs{/sha}","trees_url":"https://api.github.com/repos/josemigallas/tennisWebApp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/josemigallas/tennisWebApp/statuses/{sha}","languages_url":"https://api.github.com/repos/josemigallas/tennisWebApp/languages","stargazers_url":"https://api.github.com/repos/josemigallas/tennisWebApp/stargazers","contributors_url":"https://api.github.com/repos/josemigallas/tennisWebApp/contributors","subscribers_url":"https://api.github.com/repos/josemigallas/tennisWebApp/subscribers","subscription_url":"https://api.github.com/repos/josemigallas/tennisWebApp/subscription","commits_url":"https://api.github.com/repos/josemigallas/tennisWebApp/commits{/sha}","git_commits_url":"https://api.github.com/repos/josemigallas/tennisWebApp/git/commits{/sha}","comments_url":"https://api.github.com/repos/josemigallas/tennisWebApp/comments{/number}","issue_comment_url":"https://api.github.com/repos/josemigallas/tennisWebApp/issues/comments{/number}","contents_url":"https://api.github.com/repos/josemigallas/tennisWebApp/contents/{+path}","compare_url":"https://api.github.com/repos/josemigallas/tennisWebApp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/josemigallas/tennisWebApp/merges","archive_url":"https://api.github.com/repos/josemigallas/tennisWebApp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/josemigallas/tennisWebApp/downloads","issues_url":"https://api.github.com/repos/josemigallas/tennisWebApp/issues{/number}","pulls_url":"https://api.github.com/repos/josemigallas/tennisWebApp/pulls{/number}","milestones_url":"https://api.github.com/repos/josemigallas/tennisWebApp/milestones{/number}","notifications_url":"https://api.github.com/repos/josemigallas/tennisWebApp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/josemigallas/tennisWebApp/labels{/name}","releases_url":"https://api.github.com/repos/josemigallas/tennisWebApp/releases{/id}","created_at":"2015-10-28T15:08:23Z","updated_at":"2015-10-28T15:17:27Z","pushed_at":"2015-11-08T12:01:22Z","git_url":"git://github.com/josemigallas/tennisWebApp.git","ssh_url":"git@github.com:josemigallas/tennisWebApp.git","clone_url":"https://github.com/josemigallas/tennisWebApp.git","svn_url":"https://github.com/josemigallas/tennisWebApp","homepage":null,"size":172,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"josemigallas:master","ref":"master","sha":"75be22f682bbd6c2532845cb7b70914374b20eee","user":{"login":"josemigallas","id":11672286,"avatar_url":"https://avatars.githubusercontent.com/u/11672286?v=3","gravatar_id":"","url":"https://api.github.com/users/josemigallas","html_url":"https://github.com/josemigallas","followers_url":"https://api.github.com/users/josemigallas/followers","following_url":"https://api.github.com/users/josemigallas/following{/other_user}","gists_url":"https://api.github.com/users/josemigallas/gists{/gist_id}","starred_url":"https://api.github.com/users/josemigallas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josemigallas/subscriptions","organizations_url":"https://api.github.com/users/josemigallas/orgs","repos_url":"https://api.github.com/users/josemigallas/repos","events_url":"https://api.github.com/users/josemigallas/events{/privacy}","received_events_url":"https://api.github.com/users/josemigallas/received_events","type":"User","site_admin":false},"repo":{"id":45120652,"name":"tennisWebApp","full_name":"josemigallas/tennisWebApp","owner":{"login":"josemigallas","id":11672286,"avatar_url":"https://avatars.githubusercontent.com/u/11672286?v=3","gravatar_id":"","url":"https://api.github.com/users/josemigallas","html_url":"https://github.com/josemigallas","followers_url":"https://api.github.com/users/josemigallas/followers","following_url":"https://api.github.com/users/josemigallas/following{/other_user}","gists_url":"https://api.github.com/users/josemigallas/gists{/gist_id}","starred_url":"https://api.github.com/users/josemigallas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josemigallas/subscriptions","organizations_url":"https://api.github.com/users/josemigallas/orgs","repos_url":"https://api.github.com/users/josemigallas/repos","events_url":"https://api.github.com/users/josemigallas/events{/privacy}","received_events_url":"https://api.github.com/users/josemigallas/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/josemigallas/tennisWebApp","description":"","fork":false,"url":"https://api.github.com/repos/josemigallas/tennisWebApp","forks_url":"https://api.github.com/repos/josemigallas/tennisWebApp/forks","keys_url":"https://api.github.com/repos/josemigallas/tennisWebApp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/josemigallas/tennisWebApp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/josemigallas/tennisWebApp/teams","hooks_url":"https://api.github.com/repos/josemigallas/tennisWebApp/hooks","issue_events_url":"https://api.github.com/repos/josemigallas/tennisWebApp/issues/events{/number}","events_url":"https://api.github.com/repos/josemigallas/tennisWebApp/events","assignees_url":"https://api.github.com/repos/josemigallas/tennisWebApp/assignees{/user}","branches_url":"https://api.github.com/repos/josemigallas/tennisWebApp/branches{/branch}","tags_url":"https://api.github.com/repos/josemigallas/tennisWebApp/tags","blobs_url":"https://api.github.com/repos/josemigallas/tennisWebApp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/josemigallas/tennisWebApp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/josemigallas/tennisWebApp/git/refs{/sha}","trees_url":"https://api.github.com/repos/josemigallas/tennisWebApp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/josemigallas/tennisWebApp/statuses/{sha}","languages_url":"https://api.github.com/repos/josemigallas/tennisWebApp/languages","stargazers_url":"https://api.github.com/repos/josemigallas/tennisWebApp/stargazers","contributors_url":"https://api.github.com/repos/josemigallas/tennisWebApp/contributors","subscribers_url":"https://api.github.com/repos/josemigallas/tennisWebApp/subscribers","subscription_url":"https://api.github.com/repos/josemigallas/tennisWebApp/subscription","commits_url":"https://api.github.com/repos/josemigallas/tennisWebApp/commits{/sha}","git_commits_url":"https://api.github.com/repos/josemigallas/tennisWebApp/git/commits{/sha}","comments_url":"https://api.github.com/repos/josemigallas/tennisWebApp/comments{/number}","issue_comment_url":"https://api.github.com/repos/josemigallas/tennisWebApp/issues/comments{/number}","contents_url":"https://api.github.com/repos/josemigallas/tennisWebApp/contents/{+path}","compare_url":"https://api.github.com/repos/josemigallas/tennisWebApp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/josemigallas/tennisWebApp/merges","archive_url":"https://api.github.com/repos/josemigallas/tennisWebApp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/josemigallas/tennisWebApp/downloads","issues_url":"https://api.github.com/repos/josemigallas/tennisWebApp/issues{/number}","pulls_url":"https://api.github.com/repos/josemigallas/tennisWebApp/pulls{/number}","milestones_url":"https://api.github.com/repos/josemigallas/tennisWebApp/milestones{/number}","notifications_url":"https://api.github.com/repos/josemigallas/tennisWebApp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/josemigallas/tennisWebApp/labels{/name}","releases_url":"https://api.github.com/repos/josemigallas/tennisWebApp/releases{/id}","created_at":"2015-10-28T15:08:23Z","updated_at":"2015-10-28T15:17:27Z","pushed_at":"2015-11-08T12:01:22Z","git_url":"git://github.com/josemigallas/tennisWebApp.git","ssh_url":"git@github.com:josemigallas/tennisWebApp.git","clone_url":"https://github.com/josemigallas/tennisWebApp.git","svn_url":"https://github.com/josemigallas/tennisWebApp","homepage":null,"size":172,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/josemigallas/tennisWebApp/pulls/2"},"html":{"href":"https://github.com/josemigallas/tennisWebApp/pull/2"},"issue":{"href":"https://api.github.com/repos/josemigallas/tennisWebApp/issues/2"},"comments":{"href":"https://api.github.com/repos/josemigallas/tennisWebApp/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/josemigallas/tennisWebApp/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/josemigallas/tennisWebApp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/josemigallas/tennisWebApp/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/josemigallas/tennisWebApp/statuses/53e3551a797bb56d210e84a55da733aba7789b44"}}}}