{"action":"created","comment":{"url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/pulls/comments/209815366","pull_request_review_id":145901237,"id":209815366,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwOTgxNTM2Ng==","diff_hunk":"@@ -1,26 +1,77 @@\n # frozen_string_literal: true\n \n class Match < ApplicationRecord\n+  include Timeable\n+\n   belongs_to :tournament\n   belongs_to :team_one, class_name: \"Team\", foreign_key: \"team_one_id\"\n   belongs_to :team_two, class_name: \"Team\", foreign_key: \"team_two_id\"\n+  has_one :timer, dependent: :destroy\n+\n+  validates :duration, presence: true\n \n+  # Public: Queries for the two team associated with a match.\n+  #\n+  # Examples\n+  #\n+  #   team_one, team_two = Team.last(2)\n+  #   match = Match.create(team_one_id: team_one.id, team_two_id: team_two.id)\n+  #   match.teams\n+  #   # => Team::ActiveRecord_Relation\n+  #\n+  # Returns a collection containing two associated Team record objects.\n   def teams\n     Team.where(id: [team_one_id, team_two_id])\n   end\n \n+  # Public: Builds a hash containing the team's current score.\n+  #\n+  # Examples\n+  #\n+  #   team_one, team_two = Team.last(2)\n+  #   match = Match.create(team_one_id: team_one.id, team_two_id: team_two.id)\n+  #   match.score\n+  #   # => {\"team_one_name\"=>1, \"team_two_name\"=>3}\n+  #\n+  # Returns a hash containing each team's name and score.\n   def score\n     Hash[teams.map(&:name).zip([team_one_score, team_two_score])]","path":"app/models/match.rb","position":38,"original_position":38,"commit_id":"c180cba36841e3fdc421ee8b077cf271d3bb5cd7","original_commit_id":"f09a2f6ec490d3af09c3d854a0037bdb7bda47e8","user":{"login":"eiei0","id":7936226,"node_id":"MDQ6VXNlcjc5MzYyMjY=","avatar_url":"https://avatars2.githubusercontent.com/u/7936226?v=4","gravatar_id":"","url":"https://api.github.com/users/eiei0","html_url":"https://github.com/eiei0","followers_url":"https://api.github.com/users/eiei0/followers","following_url":"https://api.github.com/users/eiei0/following{/other_user}","gists_url":"https://api.github.com/users/eiei0/gists{/gist_id}","starred_url":"https://api.github.com/users/eiei0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eiei0/subscriptions","organizations_url":"https://api.github.com/users/eiei0/orgs","repos_url":"https://api.github.com/users/eiei0/repos","events_url":"https://api.github.com/users/eiei0/events{/privacy}","received_events_url":"https://api.github.com/users/eiei0/received_events","type":"User","site_admin":false},"body":"Definitely simpler. 😄 ","created_at":"2018-08-14T02:49:03Z","updated_at":"2018-08-14T02:49:03Z","html_url":"https://github.com/nguyenmv2/tourneybikepolo-be/pull/9#discussion_r209815366","pull_request_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/pulls/9","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/pulls/comments/209815366"},"html":{"href":"https://github.com/nguyenmv2/tourneybikepolo-be/pull/9#discussion_r209815366"},"pull_request":{"href":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/pulls/9"}},"in_reply_to_id":209811871},"pull_request":{"url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/pulls/9","id":207855322,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA3ODU1MzIy","html_url":"https://github.com/nguyenmv2/tourneybikepolo-be/pull/9","diff_url":"https://github.com/nguyenmv2/tourneybikepolo-be/pull/9.diff","patch_url":"https://github.com/nguyenmv2/tourneybikepolo-be/pull/9.patch","issue_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/issues/9","number":9,"state":"open","locked":false,"title":"Timer","user":{"login":"eiei0","id":7936226,"node_id":"MDQ6VXNlcjc5MzYyMjY=","avatar_url":"https://avatars2.githubusercontent.com/u/7936226?v=4","gravatar_id":"","url":"https://api.github.com/users/eiei0","html_url":"https://github.com/eiei0","followers_url":"https://api.github.com/users/eiei0/followers","following_url":"https://api.github.com/users/eiei0/following{/other_user}","gists_url":"https://api.github.com/users/eiei0/gists{/gist_id}","starred_url":"https://api.github.com/users/eiei0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eiei0/subscriptions","organizations_url":"https://api.github.com/users/eiei0/orgs","repos_url":"https://api.github.com/users/eiei0/repos","events_url":"https://api.github.com/users/eiei0/events{/privacy}","received_events_url":"https://api.github.com/users/eiei0/received_events","type":"User","site_admin":false},"body":"Timer API is a continuation of the Match API. This is simply a record of me merging the two branches.","created_at":"2018-08-13T02:11:00Z","updated_at":"2018-08-14T02:49:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a0ac9a2f28810bb0c77c5bc1c17684c1c4967648","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/pulls/9/commits","review_comments_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/pulls/9/comments","review_comment_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/issues/9/comments","statuses_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/statuses/c180cba36841e3fdc421ee8b077cf271d3bb5cd7","head":{"label":"nguyenmv2:timer","ref":"timer","sha":"c180cba36841e3fdc421ee8b077cf271d3bb5cd7","user":{"login":"nguyenmv2","id":6964615,"node_id":"MDQ6VXNlcjY5NjQ2MTU=","avatar_url":"https://avatars1.githubusercontent.com/u/6964615?v=4","gravatar_id":"","url":"https://api.github.com/users/nguyenmv2","html_url":"https://github.com/nguyenmv2","followers_url":"https://api.github.com/users/nguyenmv2/followers","following_url":"https://api.github.com/users/nguyenmv2/following{/other_user}","gists_url":"https://api.github.com/users/nguyenmv2/gists{/gist_id}","starred_url":"https://api.github.com/users/nguyenmv2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nguyenmv2/subscriptions","organizations_url":"https://api.github.com/users/nguyenmv2/orgs","repos_url":"https://api.github.com/users/nguyenmv2/repos","events_url":"https://api.github.com/users/nguyenmv2/events{/privacy}","received_events_url":"https://api.github.com/users/nguyenmv2/received_events","type":"User","site_admin":false},"repo":{"id":136835499,"node_id":"MDEwOlJlcG9zaXRvcnkxMzY4MzU0OTk=","name":"tourneybikepolo-be","full_name":"nguyenmv2/tourneybikepolo-be","owner":{"login":"nguyenmv2","id":6964615,"node_id":"MDQ6VXNlcjY5NjQ2MTU=","avatar_url":"https://avatars1.githubusercontent.com/u/6964615?v=4","gravatar_id":"","url":"https://api.github.com/users/nguyenmv2","html_url":"https://github.com/nguyenmv2","followers_url":"https://api.github.com/users/nguyenmv2/followers","following_url":"https://api.github.com/users/nguyenmv2/following{/other_user}","gists_url":"https://api.github.com/users/nguyenmv2/gists{/gist_id}","starred_url":"https://api.github.com/users/nguyenmv2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nguyenmv2/subscriptions","organizations_url":"https://api.github.com/users/nguyenmv2/orgs","repos_url":"https://api.github.com/users/nguyenmv2/repos","events_url":"https://api.github.com/users/nguyenmv2/events{/privacy}","received_events_url":"https://api.github.com/users/nguyenmv2/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nguyenmv2/tourneybikepolo-be","description":null,"fork":false,"url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be","forks_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/forks","keys_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/teams","hooks_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/hooks","issue_events_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/issues/events{/number}","events_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/events","assignees_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/assignees{/user}","branches_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/branches{/branch}","tags_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/tags","blobs_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/git/refs{/sha}","trees_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/statuses/{sha}","languages_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/languages","stargazers_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/stargazers","contributors_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/contributors","subscribers_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/subscribers","subscription_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/subscription","commits_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/commits{/sha}","git_commits_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/git/commits{/sha}","comments_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/comments{/number}","issue_comment_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/issues/comments{/number}","contents_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/contents/{+path}","compare_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/merges","archive_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/downloads","issues_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/issues{/number}","pulls_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/pulls{/number}","milestones_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/milestones{/number}","notifications_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/labels{/name}","releases_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/releases{/id}","deployments_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/deployments","created_at":"2018-06-10T18:43:49Z","updated_at":"2018-08-13T01:11:20Z","pushed_at":"2018-08-14T02:19:08Z","git_url":"git://github.com/nguyenmv2/tourneybikepolo-be.git","ssh_url":"git@github.com:nguyenmv2/tourneybikepolo-be.git","clone_url":"https://github.com/nguyenmv2/tourneybikepolo-be.git","svn_url":"https://github.com/nguyenmv2/tourneybikepolo-be","homepage":null,"size":239,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"nguyenmv2:match_api","ref":"match_api","sha":"4698bf7bc772cdc972e8624f3609b967f5b361a5","user":{"login":"nguyenmv2","id":6964615,"node_id":"MDQ6VXNlcjY5NjQ2MTU=","avatar_url":"https://avatars1.githubusercontent.com/u/6964615?v=4","gravatar_id":"","url":"https://api.github.com/users/nguyenmv2","html_url":"https://github.com/nguyenmv2","followers_url":"https://api.github.com/users/nguyenmv2/followers","following_url":"https://api.github.com/users/nguyenmv2/following{/other_user}","gists_url":"https://api.github.com/users/nguyenmv2/gists{/gist_id}","starred_url":"https://api.github.com/users/nguyenmv2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nguyenmv2/subscriptions","organizations_url":"https://api.github.com/users/nguyenmv2/orgs","repos_url":"https://api.github.com/users/nguyenmv2/repos","events_url":"https://api.github.com/users/nguyenmv2/events{/privacy}","received_events_url":"https://api.github.com/users/nguyenmv2/received_events","type":"User","site_admin":false},"repo":{"id":136835499,"node_id":"MDEwOlJlcG9zaXRvcnkxMzY4MzU0OTk=","name":"tourneybikepolo-be","full_name":"nguyenmv2/tourneybikepolo-be","owner":{"login":"nguyenmv2","id":6964615,"node_id":"MDQ6VXNlcjY5NjQ2MTU=","avatar_url":"https://avatars1.githubusercontent.com/u/6964615?v=4","gravatar_id":"","url":"https://api.github.com/users/nguyenmv2","html_url":"https://github.com/nguyenmv2","followers_url":"https://api.github.com/users/nguyenmv2/followers","following_url":"https://api.github.com/users/nguyenmv2/following{/other_user}","gists_url":"https://api.github.com/users/nguyenmv2/gists{/gist_id}","starred_url":"https://api.github.com/users/nguyenmv2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nguyenmv2/subscriptions","organizations_url":"https://api.github.com/users/nguyenmv2/orgs","repos_url":"https://api.github.com/users/nguyenmv2/repos","events_url":"https://api.github.com/users/nguyenmv2/events{/privacy}","received_events_url":"https://api.github.com/users/nguyenmv2/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nguyenmv2/tourneybikepolo-be","description":null,"fork":false,"url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be","forks_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/forks","keys_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/teams","hooks_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/hooks","issue_events_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/issues/events{/number}","events_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/events","assignees_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/assignees{/user}","branches_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/branches{/branch}","tags_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/tags","blobs_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/git/refs{/sha}","trees_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/statuses/{sha}","languages_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/languages","stargazers_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/stargazers","contributors_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/contributors","subscribers_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/subscribers","subscription_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/subscription","commits_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/commits{/sha}","git_commits_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/git/commits{/sha}","comments_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/comments{/number}","issue_comment_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/issues/comments{/number}","contents_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/contents/{+path}","compare_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/merges","archive_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/downloads","issues_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/issues{/number}","pulls_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/pulls{/number}","milestones_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/milestones{/number}","notifications_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/labels{/name}","releases_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/releases{/id}","deployments_url":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/deployments","created_at":"2018-06-10T18:43:49Z","updated_at":"2018-08-13T01:11:20Z","pushed_at":"2018-08-14T02:19:08Z","git_url":"git://github.com/nguyenmv2/tourneybikepolo-be.git","ssh_url":"git@github.com:nguyenmv2/tourneybikepolo-be.git","clone_url":"https://github.com/nguyenmv2/tourneybikepolo-be.git","svn_url":"https://github.com/nguyenmv2/tourneybikepolo-be","homepage":null,"size":239,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/pulls/9"},"html":{"href":"https://github.com/nguyenmv2/tourneybikepolo-be/pull/9"},"issue":{"href":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/issues/9"},"comments":{"href":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/nguyenmv2/tourneybikepolo-be/statuses/c180cba36841e3fdc421ee8b077cf271d3bb5cd7"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"eiei0"}}