{"action":"created","comment":{"url":"https://api.github.com/repos/relaylabs/scorenami/pulls/comments/141202158","pull_request_review_id":65378765,"id":141202158,"diff_hunk":"@@ -0,0 +1,103 @@\n+const axios = require('axios');\n+\n+const config = require('../config/config');\n+\n+const APICall = (resource, args) => {\n+  const composedQuery = Object.assign({ api_key: process.env.PRO_FOOTBALL_API_KEY }, args);\n+\n+  return axios.post(`${config['apiBaseUrl']}/${resource}`, composedQuery)\n+}\n+\n+const translateGameSchema = (dataAPI) => {\n+  //console.log(\"API DATA: \", dataAPI.home.stats);\n+\n+  const dataGraphQL = dataAPI\n+  dataGraphQL.id = dataAPI.nfl_id\n+  dataGraphQL.seasonType = dataAPI.season_type\n+  dataGraphQL.awayScore = dataAPI.home_score\n+  dataGraphQL.awayScore = dataAPI.away_score\n+  dataGraphQL.home = translateTeamGameDetailSchema(dataAPI.home)\n+  dataGraphQL.away = translateTeamGameDetailSchema(dataAPI.away)\n+\n+  return dataGraphQL\n+}\n+\n+const translateTeamGameDetailSchema = (dataAPI) => {\n+  const dataGraphQL = dataAPI\n+  const drives = []\n+  for (drive in dataAPI.drives) {\n+    drives.push(translateDriveSchema(dataAPI.drives[drive]))\n+  }\n+  dataGraphQL.drives = drives\n+  dataGraphQL.stats = translateStatsSchema(dataAPI.stats)\n+\n+  return dataGraphQL\n+}\n+\n+const translateDriveSchema = (dataAPI) => {\n+  const dataGraphQL = dataAPI\n+  dataGraphQL.id = dataAPI.nfl_id\n+  dataGraphQL.driveId = dataAPI.drive_id\n+  const plays = []\n+  for (play in dataAPI.plays) {\n+    plays.push(dataAPI.plays[play])\n+  }\n+  dataGraphQL.plays = plays\n+\n+  return dataGraphQL\n+}\n+\n+const translateStatsSchema = (dataAPI) => {\n+  return {\n+    passing: statsTransform(dataAPI.passing, 'playNumber'),\n+    rushing: statsTransform(dataAPI.rushing, 'playNumber'),\n+    kickReturn: statsTransform(dataAPI.kick_return, 'playNumber'),\n+    puntReturn: statsTransform(dataAPI.punt_return, 'playNumber'),\n+    receiving: statsTransform(dataAPI.receiving, 'playNumber'),\n+    fumbles: statsTransform(dataAPI.fumbles, 'playNumber'),\n+    kicking: statsTransform(dataAPI.kicking, 'playNumber'),\n+    defense: statsTransform(dataAPI.defense, 'playNumber'),\n+    punting: statsTransform(dataAPI.punting, 'playNumber'),\n+  }\n+}\n+\n+const translatePlaySchema = (dataAPI) => {\n+  const dataGraphQL = dataAPI\n+  dataGraphQL.id = dataAPI.nfl_id\n+\n+  return dataGraphQL\n+}\n+\n+const statsTransform = (dataAPI, idPropName) => {","path":"packages/scorenami-api/lib/utilities.js","position":71,"original_position":71,"commit_id":"f8e8f0827009960ee126b5d2104724752904e7cf","original_commit_id":"f8e8f0827009960ee126b5d2104724752904e7cf","user":{"login":"iansu","id":433725,"avatar_url":"https://avatars2.githubusercontent.com/u/433725?v=4","gravatar_id":"","url":"https://api.github.com/users/iansu","html_url":"https://github.com/iansu","followers_url":"https://api.github.com/users/iansu/followers","following_url":"https://api.github.com/users/iansu/following{/other_user}","gists_url":"https://api.github.com/users/iansu/gists{/gist_id}","starred_url":"https://api.github.com/users/iansu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iansu/subscriptions","organizations_url":"https://api.github.com/users/iansu/orgs","repos_url":"https://api.github.com/users/iansu/repos","events_url":"https://api.github.com/users/iansu/events{/privacy}","received_events_url":"https://api.github.com/users/iansu/received_events","type":"User","site_admin":false},"body":"It's hard to follow what's going on in this function. Improve the naming and formatting and consider breaking it up into smaller functions.","created_at":"2017-09-26T22:29:12Z","updated_at":"2017-09-26T22:33:33Z","html_url":"https://github.com/relaylabs/scorenami/pull/2#discussion_r141202158","pull_request_url":"https://api.github.com/repos/relaylabs/scorenami/pulls/2","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/relaylabs/scorenami/pulls/comments/141202158"},"html":{"href":"https://github.com/relaylabs/scorenami/pull/2#discussion_r141202158"},"pull_request":{"href":"https://api.github.com/repos/relaylabs/scorenami/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/relaylabs/scorenami/pulls/2","id":143215256,"html_url":"https://github.com/relaylabs/scorenami/pull/2","diff_url":"https://github.com/relaylabs/scorenami/pull/2.diff","patch_url":"https://github.com/relaylabs/scorenami/pull/2.patch","issue_url":"https://api.github.com/repos/relaylabs/scorenami/issues/2","number":2,"state":"open","locked":false,"title":"Api game resolvers","user":{"login":"Nosmohta","id":25111122,"avatar_url":"https://avatars1.githubusercontent.com/u/25111122?v=4","gravatar_id":"","url":"https://api.github.com/users/Nosmohta","html_url":"https://github.com/Nosmohta","followers_url":"https://api.github.com/users/Nosmohta/followers","following_url":"https://api.github.com/users/Nosmohta/following{/other_user}","gists_url":"https://api.github.com/users/Nosmohta/gists{/gist_id}","starred_url":"https://api.github.com/users/Nosmohta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nosmohta/subscriptions","organizations_url":"https://api.github.com/users/Nosmohta/orgs","repos_url":"https://api.github.com/users/Nosmohta/repos","events_url":"https://api.github.com/users/Nosmohta/events{/privacy}","received_events_url":"https://api.github.com/users/Nosmohta/received_events","type":"User","site_admin":false},"body":"I've created a graphQL resolver for a `Game`. The resolver returns a deeply nested data structure that has been transformed from the API data schema into the scorenami graphQL data schema.","created_at":"2017-09-26T18:55:03Z","updated_at":"2017-09-26T22:33:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1d83d8df4c131cd74865bc125b3e2433dffa45b2","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/relaylabs/scorenami/pulls/2/commits","review_comments_url":"https://api.github.com/repos/relaylabs/scorenami/pulls/2/comments","review_comment_url":"https://api.github.com/repos/relaylabs/scorenami/pulls/comments{/number}","comments_url":"https://api.github.com/repos/relaylabs/scorenami/issues/2/comments","statuses_url":"https://api.github.com/repos/relaylabs/scorenami/statuses/f8e8f0827009960ee126b5d2104724752904e7cf","head":{"label":"relaylabs:API_game_resolvers","ref":"API_game_resolvers","sha":"f8e8f0827009960ee126b5d2104724752904e7cf","user":{"login":"relaylabs","id":19616989,"avatar_url":"https://avatars2.githubusercontent.com/u/19616989?v=4","gravatar_id":"","url":"https://api.github.com/users/relaylabs","html_url":"https://github.com/relaylabs","followers_url":"https://api.github.com/users/relaylabs/followers","following_url":"https://api.github.com/users/relaylabs/following{/other_user}","gists_url":"https://api.github.com/users/relaylabs/gists{/gist_id}","starred_url":"https://api.github.com/users/relaylabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/relaylabs/subscriptions","organizations_url":"https://api.github.com/users/relaylabs/orgs","repos_url":"https://api.github.com/users/relaylabs/repos","events_url":"https://api.github.com/users/relaylabs/events{/privacy}","received_events_url":"https://api.github.com/users/relaylabs/received_events","type":"Organization","site_admin":false},"repo":{"id":104589856,"name":"scorenami","full_name":"relaylabs/scorenami","owner":{"login":"relaylabs","id":19616989,"avatar_url":"https://avatars2.githubusercontent.com/u/19616989?v=4","gravatar_id":"","url":"https://api.github.com/users/relaylabs","html_url":"https://github.com/relaylabs","followers_url":"https://api.github.com/users/relaylabs/followers","following_url":"https://api.github.com/users/relaylabs/following{/other_user}","gists_url":"https://api.github.com/users/relaylabs/gists{/gist_id}","starred_url":"https://api.github.com/users/relaylabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/relaylabs/subscriptions","organizations_url":"https://api.github.com/users/relaylabs/orgs","repos_url":"https://api.github.com/users/relaylabs/repos","events_url":"https://api.github.com/users/relaylabs/events{/privacy}","received_events_url":"https://api.github.com/users/relaylabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/relaylabs/scorenami","description":"🌊 🏈 Real time sports scores.","fork":false,"url":"https://api.github.com/repos/relaylabs/scorenami","forks_url":"https://api.github.com/repos/relaylabs/scorenami/forks","keys_url":"https://api.github.com/repos/relaylabs/scorenami/keys{/key_id}","collaborators_url":"https://api.github.com/repos/relaylabs/scorenami/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/relaylabs/scorenami/teams","hooks_url":"https://api.github.com/repos/relaylabs/scorenami/hooks","issue_events_url":"https://api.github.com/repos/relaylabs/scorenami/issues/events{/number}","events_url":"https://api.github.com/repos/relaylabs/scorenami/events","assignees_url":"https://api.github.com/repos/relaylabs/scorenami/assignees{/user}","branches_url":"https://api.github.com/repos/relaylabs/scorenami/branches{/branch}","tags_url":"https://api.github.com/repos/relaylabs/scorenami/tags","blobs_url":"https://api.github.com/repos/relaylabs/scorenami/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/relaylabs/scorenami/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/relaylabs/scorenami/git/refs{/sha}","trees_url":"https://api.github.com/repos/relaylabs/scorenami/git/trees{/sha}","statuses_url":"https://api.github.com/repos/relaylabs/scorenami/statuses/{sha}","languages_url":"https://api.github.com/repos/relaylabs/scorenami/languages","stargazers_url":"https://api.github.com/repos/relaylabs/scorenami/stargazers","contributors_url":"https://api.github.com/repos/relaylabs/scorenami/contributors","subscribers_url":"https://api.github.com/repos/relaylabs/scorenami/subscribers","subscription_url":"https://api.github.com/repos/relaylabs/scorenami/subscription","commits_url":"https://api.github.com/repos/relaylabs/scorenami/commits{/sha}","git_commits_url":"https://api.github.com/repos/relaylabs/scorenami/git/commits{/sha}","comments_url":"https://api.github.com/repos/relaylabs/scorenami/comments{/number}","issue_comment_url":"https://api.github.com/repos/relaylabs/scorenami/issues/comments{/number}","contents_url":"https://api.github.com/repos/relaylabs/scorenami/contents/{+path}","compare_url":"https://api.github.com/repos/relaylabs/scorenami/compare/{base}...{head}","merges_url":"https://api.github.com/repos/relaylabs/scorenami/merges","archive_url":"https://api.github.com/repos/relaylabs/scorenami/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/relaylabs/scorenami/downloads","issues_url":"https://api.github.com/repos/relaylabs/scorenami/issues{/number}","pulls_url":"https://api.github.com/repos/relaylabs/scorenami/pulls{/number}","milestones_url":"https://api.github.com/repos/relaylabs/scorenami/milestones{/number}","notifications_url":"https://api.github.com/repos/relaylabs/scorenami/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/relaylabs/scorenami/labels{/name}","releases_url":"https://api.github.com/repos/relaylabs/scorenami/releases{/id}","deployments_url":"https://api.github.com/repos/relaylabs/scorenami/deployments","created_at":"2017-09-23T18:29:02Z","updated_at":"2017-09-25T16:53:31Z","pushed_at":"2017-09-26T21:37:49Z","git_url":"git://github.com/relaylabs/scorenami.git","ssh_url":"git@github.com:relaylabs/scorenami.git","clone_url":"https://github.com/relaylabs/scorenami.git","svn_url":"https://github.com/relaylabs/scorenami","homepage":"","size":283,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"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":"relaylabs:master","ref":"master","sha":"ca0e421b847f119df8c54ef104ea32ddf9e9ebb9","user":{"login":"relaylabs","id":19616989,"avatar_url":"https://avatars2.githubusercontent.com/u/19616989?v=4","gravatar_id":"","url":"https://api.github.com/users/relaylabs","html_url":"https://github.com/relaylabs","followers_url":"https://api.github.com/users/relaylabs/followers","following_url":"https://api.github.com/users/relaylabs/following{/other_user}","gists_url":"https://api.github.com/users/relaylabs/gists{/gist_id}","starred_url":"https://api.github.com/users/relaylabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/relaylabs/subscriptions","organizations_url":"https://api.github.com/users/relaylabs/orgs","repos_url":"https://api.github.com/users/relaylabs/repos","events_url":"https://api.github.com/users/relaylabs/events{/privacy}","received_events_url":"https://api.github.com/users/relaylabs/received_events","type":"Organization","site_admin":false},"repo":{"id":104589856,"name":"scorenami","full_name":"relaylabs/scorenami","owner":{"login":"relaylabs","id":19616989,"avatar_url":"https://avatars2.githubusercontent.com/u/19616989?v=4","gravatar_id":"","url":"https://api.github.com/users/relaylabs","html_url":"https://github.com/relaylabs","followers_url":"https://api.github.com/users/relaylabs/followers","following_url":"https://api.github.com/users/relaylabs/following{/other_user}","gists_url":"https://api.github.com/users/relaylabs/gists{/gist_id}","starred_url":"https://api.github.com/users/relaylabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/relaylabs/subscriptions","organizations_url":"https://api.github.com/users/relaylabs/orgs","repos_url":"https://api.github.com/users/relaylabs/repos","events_url":"https://api.github.com/users/relaylabs/events{/privacy}","received_events_url":"https://api.github.com/users/relaylabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/relaylabs/scorenami","description":"🌊 🏈 Real time sports scores.","fork":false,"url":"https://api.github.com/repos/relaylabs/scorenami","forks_url":"https://api.github.com/repos/relaylabs/scorenami/forks","keys_url":"https://api.github.com/repos/relaylabs/scorenami/keys{/key_id}","collaborators_url":"https://api.github.com/repos/relaylabs/scorenami/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/relaylabs/scorenami/teams","hooks_url":"https://api.github.com/repos/relaylabs/scorenami/hooks","issue_events_url":"https://api.github.com/repos/relaylabs/scorenami/issues/events{/number}","events_url":"https://api.github.com/repos/relaylabs/scorenami/events","assignees_url":"https://api.github.com/repos/relaylabs/scorenami/assignees{/user}","branches_url":"https://api.github.com/repos/relaylabs/scorenami/branches{/branch}","tags_url":"https://api.github.com/repos/relaylabs/scorenami/tags","blobs_url":"https://api.github.com/repos/relaylabs/scorenami/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/relaylabs/scorenami/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/relaylabs/scorenami/git/refs{/sha}","trees_url":"https://api.github.com/repos/relaylabs/scorenami/git/trees{/sha}","statuses_url":"https://api.github.com/repos/relaylabs/scorenami/statuses/{sha}","languages_url":"https://api.github.com/repos/relaylabs/scorenami/languages","stargazers_url":"https://api.github.com/repos/relaylabs/scorenami/stargazers","contributors_url":"https://api.github.com/repos/relaylabs/scorenami/contributors","subscribers_url":"https://api.github.com/repos/relaylabs/scorenami/subscribers","subscription_url":"https://api.github.com/repos/relaylabs/scorenami/subscription","commits_url":"https://api.github.com/repos/relaylabs/scorenami/commits{/sha}","git_commits_url":"https://api.github.com/repos/relaylabs/scorenami/git/commits{/sha}","comments_url":"https://api.github.com/repos/relaylabs/scorenami/comments{/number}","issue_comment_url":"https://api.github.com/repos/relaylabs/scorenami/issues/comments{/number}","contents_url":"https://api.github.com/repos/relaylabs/scorenami/contents/{+path}","compare_url":"https://api.github.com/repos/relaylabs/scorenami/compare/{base}...{head}","merges_url":"https://api.github.com/repos/relaylabs/scorenami/merges","archive_url":"https://api.github.com/repos/relaylabs/scorenami/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/relaylabs/scorenami/downloads","issues_url":"https://api.github.com/repos/relaylabs/scorenami/issues{/number}","pulls_url":"https://api.github.com/repos/relaylabs/scorenami/pulls{/number}","milestones_url":"https://api.github.com/repos/relaylabs/scorenami/milestones{/number}","notifications_url":"https://api.github.com/repos/relaylabs/scorenami/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/relaylabs/scorenami/labels{/name}","releases_url":"https://api.github.com/repos/relaylabs/scorenami/releases{/id}","deployments_url":"https://api.github.com/repos/relaylabs/scorenami/deployments","created_at":"2017-09-23T18:29:02Z","updated_at":"2017-09-25T16:53:31Z","pushed_at":"2017-09-26T21:37:49Z","git_url":"git://github.com/relaylabs/scorenami.git","ssh_url":"git@github.com:relaylabs/scorenami.git","clone_url":"https://github.com/relaylabs/scorenami.git","svn_url":"https://github.com/relaylabs/scorenami","homepage":"","size":283,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"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/relaylabs/scorenami/pulls/2"},"html":{"href":"https://github.com/relaylabs/scorenami/pull/2"},"issue":{"href":"https://api.github.com/repos/relaylabs/scorenami/issues/2"},"comments":{"href":"https://api.github.com/repos/relaylabs/scorenami/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/relaylabs/scorenami/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/relaylabs/scorenami/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/relaylabs/scorenami/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/relaylabs/scorenami/statuses/f8e8f0827009960ee126b5d2104724752904e7cf"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"iansu"}}