{"action":"created","comment":{"url":"https://api.github.com/repos/projectshft/weather-project/pulls/comments/166081574","pull_request_review_id":94106543,"id":166081574,"diff_hunk":"@@ -0,0 +1,204 @@\n+let weatherData = [];\n+let weekData = {};\n+\n+const DateTime = luxon.DateTime;\n+\n+const addData = (data) => {\n+  weatherData = [];\n+  let weatherFetched = {\n+    weather: Math.floor(data.main.temp),\n+    city: data.name,\n+    condition: data.weather[0].description,\n+    icon: 'http://openweathermap.org/img/w/' + data.weather[0].icon + '.png'\n+  }\n+  weatherData.push(weatherFetched);\n+  renderWeather(weatherData);\n+};\n+\n+let forecastData = [];\n+const addForecast = (data) => {\n+  forecastData = [];\n+  let forecastDays = [];\n+  for (let i = 0; i < data.list.length; i++) {\n+    let day = data.list[i];\n+    // Add the forecast days available\n+    let singleDay = parseDay(day.dt);\n+    if (!forecastDays.includes(singleDay)) {\n+      // push only days that are not in the forecastDays array\n+      forecastDays.push(singleDay);\n+    }\n+    forecastData.push(getWeather(day))\n+  } // End of for loop\n+\n+  // console.log('Starting to build days array...');\n+  // console.log(forecastDays, 'Days');\n+  // Get the information by targeting a day array\n+  // and get the index of the time I need.\n+  let singleDayData = getDaysArray(forecastData, forecastDays);\n+  weekData = singleDayData;\n+  renderWeekWeather();\n+};\n+\n+// Use DateTime to convert OpenWeather dt to milliseconds to get time\n+const convertTime = (rawDate) => DateTime.fromMillis(rawDate * 1000);\n+\n+const parseDay = (rawDate) => {\n+  let currentDate = convertTime(rawDate);\n+  // Get a string day of the week of the next five days\n+  let currentDay = currentDate.toFormat('DDDD').split(',', 1).toString()\n+  // console.log(currentDay);\n+  return currentDay;\n+}\n+                                                                  \n+const getWeather = (currentDay) => {\n+  let dayForecasted = convertTime(currentDay.dt).toFormat('DDDD').split(',', 1).toString()\n+  let weather = Math.floor(currentDay.main.temp);\n+  let condition = currentDay.weather[0].main;\n+  let iconString = currentDay.weather[0].icon;\n+  let currentTimeData = convertTime(currentDay.dt).toObject();\n+  return {\n+    day: dayForecasted,\n+    weather: weather,\n+    condition: condition,\n+    icon: 'http://openweathermap.org/img/w/' + iconString + '.png',\n+    timeData: currentTimeData\n+  }\n+\n+}\n+\n+const getDaysArray = (data, days) => {\n+  let daysObj = {\n+    // Do not return a 6th day\n+    // In some cases we get a 6th array\n+  }\n+  let start = 0;\n+  let eachDayArray = []\n+  for (let index = 0; index < data.length; index++) {\n+    let currentDay = days[start];\n+    const forecastObj = data[index];\n+    if (_.contains(forecastObj, currentDay)) {\n+      // console.log('Add to array');\n+      eachDayArray.push(forecastObj)\n+    } else {\n+      // add eachDayArray to the daysObj to keep track of forecast days\n+      daysObj[`day${start}`] = eachDayArray;\n+      // empty array for the next day's data\n+      eachDayArray = [];\n+      // add object containing second day to array \n+      start += 1; // add one to start to keep track of days\n+      eachDayArray.push(forecastObj)\n+    }\n+  }\n+  // add last array to our daysObj \n+  daysObj[`day${start}`] = eachDayArray;\n+  // Get daysObj to only get five days \n+  var size = Object.keys(daysObj).length;\n+  // delete if in the request we get 6 days \n+  if (size >= 6) {\n+    delete daysObj.day5;\n+  }\n+  // console.log(daysObj);\n+  return daysObj\n+","path":"main.js","position":102,"original_position":102,"commit_id":"9d27628c22f571fd19a38e2cc74a990c14d3fd95","original_commit_id":"9d27628c22f571fd19a38e2cc74a990c14d3fd95","user":{"login":"amhayslip","id":5480326,"avatar_url":"https://avatars1.githubusercontent.com/u/5480326?v=4","gravatar_id":"","url":"https://api.github.com/users/amhayslip","html_url":"https://github.com/amhayslip","followers_url":"https://api.github.com/users/amhayslip/followers","following_url":"https://api.github.com/users/amhayslip/following{/other_user}","gists_url":"https://api.github.com/users/amhayslip/gists{/gist_id}","starred_url":"https://api.github.com/users/amhayslip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amhayslip/subscriptions","organizations_url":"https://api.github.com/users/amhayslip/orgs","repos_url":"https://api.github.com/users/amhayslip/repos","events_url":"https://api.github.com/users/amhayslip/events{/privacy}","received_events_url":"https://api.github.com/users/amhayslip/received_events","type":"User","site_admin":false},"body":"No need for the new line","created_at":"2018-02-05T19:12:24Z","updated_at":"2018-02-05T19:18:00Z","html_url":"https://github.com/projectshft/weather-project/pull/6#discussion_r166081574","pull_request_url":"https://api.github.com/repos/projectshft/weather-project/pulls/6","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/projectshft/weather-project/pulls/comments/166081574"},"html":{"href":"https://github.com/projectshft/weather-project/pull/6#discussion_r166081574"},"pull_request":{"href":"https://api.github.com/repos/projectshft/weather-project/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/projectshft/weather-project/pulls/6","id":166653028,"html_url":"https://github.com/projectshft/weather-project/pull/6","diff_url":"https://github.com/projectshft/weather-project/pull/6.diff","patch_url":"https://github.com/projectshft/weather-project/pull/6.patch","issue_url":"https://api.github.com/repos/projectshft/weather-project/issues/6","number":6,"state":"open","locked":false,"title":"Implementing an API","user":{"login":"rodri0315","id":12138336,"avatar_url":"https://avatars3.githubusercontent.com/u/12138336?v=4","gravatar_id":"","url":"https://api.github.com/users/rodri0315","html_url":"https://github.com/rodri0315","followers_url":"https://api.github.com/users/rodri0315/followers","following_url":"https://api.github.com/users/rodri0315/following{/other_user}","gists_url":"https://api.github.com/users/rodri0315/gists{/gist_id}","starred_url":"https://api.github.com/users/rodri0315/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rodri0315/subscriptions","organizations_url":"https://api.github.com/users/rodri0315/orgs","repos_url":"https://api.github.com/users/rodri0315/repos","events_url":"https://api.github.com/users/rodri0315/events{/privacy}","received_events_url":"https://api.github.com/users/rodri0315/received_events","type":"User","site_admin":false},"body":"Getting weather information using OpenWeather API and getting user input to show current weather and forecast.","created_at":"2018-02-01T21:12:04Z","updated_at":"2018-02-05T19:18:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"294d99498249f52816290839de20cd9b137b6868","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/projectshft/weather-project/pulls/6/commits","review_comments_url":"https://api.github.com/repos/projectshft/weather-project/pulls/6/comments","review_comment_url":"https://api.github.com/repos/projectshft/weather-project/pulls/comments{/number}","comments_url":"https://api.github.com/repos/projectshft/weather-project/issues/6/comments","statuses_url":"https://api.github.com/repos/projectshft/weather-project/statuses/9d27628c22f571fd19a38e2cc74a990c14d3fd95","head":{"label":"rodri0315:master","ref":"master","sha":"9d27628c22f571fd19a38e2cc74a990c14d3fd95","user":{"login":"rodri0315","id":12138336,"avatar_url":"https://avatars3.githubusercontent.com/u/12138336?v=4","gravatar_id":"","url":"https://api.github.com/users/rodri0315","html_url":"https://github.com/rodri0315","followers_url":"https://api.github.com/users/rodri0315/followers","following_url":"https://api.github.com/users/rodri0315/following{/other_user}","gists_url":"https://api.github.com/users/rodri0315/gists{/gist_id}","starred_url":"https://api.github.com/users/rodri0315/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rodri0315/subscriptions","organizations_url":"https://api.github.com/users/rodri0315/orgs","repos_url":"https://api.github.com/users/rodri0315/repos","events_url":"https://api.github.com/users/rodri0315/events{/privacy}","received_events_url":"https://api.github.com/users/rodri0315/received_events","type":"User","site_admin":false},"repo":{"id":119393537,"name":"weather-project","full_name":"rodri0315/weather-project","owner":{"login":"rodri0315","id":12138336,"avatar_url":"https://avatars3.githubusercontent.com/u/12138336?v=4","gravatar_id":"","url":"https://api.github.com/users/rodri0315","html_url":"https://github.com/rodri0315","followers_url":"https://api.github.com/users/rodri0315/followers","following_url":"https://api.github.com/users/rodri0315/following{/other_user}","gists_url":"https://api.github.com/users/rodri0315/gists{/gist_id}","starred_url":"https://api.github.com/users/rodri0315/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rodri0315/subscriptions","organizations_url":"https://api.github.com/users/rodri0315/orgs","repos_url":"https://api.github.com/users/rodri0315/repos","events_url":"https://api.github.com/users/rodri0315/events{/privacy}","received_events_url":"https://api.github.com/users/rodri0315/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rodri0315/weather-project","description":null,"fork":true,"url":"https://api.github.com/repos/rodri0315/weather-project","forks_url":"https://api.github.com/repos/rodri0315/weather-project/forks","keys_url":"https://api.github.com/repos/rodri0315/weather-project/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rodri0315/weather-project/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rodri0315/weather-project/teams","hooks_url":"https://api.github.com/repos/rodri0315/weather-project/hooks","issue_events_url":"https://api.github.com/repos/rodri0315/weather-project/issues/events{/number}","events_url":"https://api.github.com/repos/rodri0315/weather-project/events","assignees_url":"https://api.github.com/repos/rodri0315/weather-project/assignees{/user}","branches_url":"https://api.github.com/repos/rodri0315/weather-project/branches{/branch}","tags_url":"https://api.github.com/repos/rodri0315/weather-project/tags","blobs_url":"https://api.github.com/repos/rodri0315/weather-project/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rodri0315/weather-project/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rodri0315/weather-project/git/refs{/sha}","trees_url":"https://api.github.com/repos/rodri0315/weather-project/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rodri0315/weather-project/statuses/{sha}","languages_url":"https://api.github.com/repos/rodri0315/weather-project/languages","stargazers_url":"https://api.github.com/repos/rodri0315/weather-project/stargazers","contributors_url":"https://api.github.com/repos/rodri0315/weather-project/contributors","subscribers_url":"https://api.github.com/repos/rodri0315/weather-project/subscribers","subscription_url":"https://api.github.com/repos/rodri0315/weather-project/subscription","commits_url":"https://api.github.com/repos/rodri0315/weather-project/commits{/sha}","git_commits_url":"https://api.github.com/repos/rodri0315/weather-project/git/commits{/sha}","comments_url":"https://api.github.com/repos/rodri0315/weather-project/comments{/number}","issue_comment_url":"https://api.github.com/repos/rodri0315/weather-project/issues/comments{/number}","contents_url":"https://api.github.com/repos/rodri0315/weather-project/contents/{+path}","compare_url":"https://api.github.com/repos/rodri0315/weather-project/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rodri0315/weather-project/merges","archive_url":"https://api.github.com/repos/rodri0315/weather-project/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rodri0315/weather-project/downloads","issues_url":"https://api.github.com/repos/rodri0315/weather-project/issues{/number}","pulls_url":"https://api.github.com/repos/rodri0315/weather-project/pulls{/number}","milestones_url":"https://api.github.com/repos/rodri0315/weather-project/milestones{/number}","notifications_url":"https://api.github.com/repos/rodri0315/weather-project/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rodri0315/weather-project/labels{/name}","releases_url":"https://api.github.com/repos/rodri0315/weather-project/releases{/id}","deployments_url":"https://api.github.com/repos/rodri0315/weather-project/deployments","created_at":"2018-01-29T14:30:10Z","updated_at":"2018-02-01T20:42:59Z","pushed_at":"2018-02-01T21:07:52Z","git_url":"git://github.com/rodri0315/weather-project.git","ssh_url":"git@github.com:rodri0315/weather-project.git","clone_url":"https://github.com/rodri0315/weather-project.git","svn_url":"https://github.com/rodri0315/weather-project","homepage":null,"size":48,"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":"projectshft:master","ref":"master","sha":"4cd2f86ab4fafed44f2a8f98f5feb184b6636ed6","user":{"login":"projectshft","id":29127881,"avatar_url":"https://avatars1.githubusercontent.com/u/29127881?v=4","gravatar_id":"","url":"https://api.github.com/users/projectshft","html_url":"https://github.com/projectshft","followers_url":"https://api.github.com/users/projectshft/followers","following_url":"https://api.github.com/users/projectshft/following{/other_user}","gists_url":"https://api.github.com/users/projectshft/gists{/gist_id}","starred_url":"https://api.github.com/users/projectshft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projectshft/subscriptions","organizations_url":"https://api.github.com/users/projectshft/orgs","repos_url":"https://api.github.com/users/projectshft/repos","events_url":"https://api.github.com/users/projectshft/events{/privacy}","received_events_url":"https://api.github.com/users/projectshft/received_events","type":"Organization","site_admin":false},"repo":{"id":115439521,"name":"weather-project","full_name":"projectshft/weather-project","owner":{"login":"projectshft","id":29127881,"avatar_url":"https://avatars1.githubusercontent.com/u/29127881?v=4","gravatar_id":"","url":"https://api.github.com/users/projectshft","html_url":"https://github.com/projectshft","followers_url":"https://api.github.com/users/projectshft/followers","following_url":"https://api.github.com/users/projectshft/following{/other_user}","gists_url":"https://api.github.com/users/projectshft/gists{/gist_id}","starred_url":"https://api.github.com/users/projectshft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projectshft/subscriptions","organizations_url":"https://api.github.com/users/projectshft/orgs","repos_url":"https://api.github.com/users/projectshft/repos","events_url":"https://api.github.com/users/projectshft/events{/privacy}","received_events_url":"https://api.github.com/users/projectshft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/projectshft/weather-project","description":null,"fork":false,"url":"https://api.github.com/repos/projectshft/weather-project","forks_url":"https://api.github.com/repos/projectshft/weather-project/forks","keys_url":"https://api.github.com/repos/projectshft/weather-project/keys{/key_id}","collaborators_url":"https://api.github.com/repos/projectshft/weather-project/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/projectshft/weather-project/teams","hooks_url":"https://api.github.com/repos/projectshft/weather-project/hooks","issue_events_url":"https://api.github.com/repos/projectshft/weather-project/issues/events{/number}","events_url":"https://api.github.com/repos/projectshft/weather-project/events","assignees_url":"https://api.github.com/repos/projectshft/weather-project/assignees{/user}","branches_url":"https://api.github.com/repos/projectshft/weather-project/branches{/branch}","tags_url":"https://api.github.com/repos/projectshft/weather-project/tags","blobs_url":"https://api.github.com/repos/projectshft/weather-project/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/projectshft/weather-project/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/projectshft/weather-project/git/refs{/sha}","trees_url":"https://api.github.com/repos/projectshft/weather-project/git/trees{/sha}","statuses_url":"https://api.github.com/repos/projectshft/weather-project/statuses/{sha}","languages_url":"https://api.github.com/repos/projectshft/weather-project/languages","stargazers_url":"https://api.github.com/repos/projectshft/weather-project/stargazers","contributors_url":"https://api.github.com/repos/projectshft/weather-project/contributors","subscribers_url":"https://api.github.com/repos/projectshft/weather-project/subscribers","subscription_url":"https://api.github.com/repos/projectshft/weather-project/subscription","commits_url":"https://api.github.com/repos/projectshft/weather-project/commits{/sha}","git_commits_url":"https://api.github.com/repos/projectshft/weather-project/git/commits{/sha}","comments_url":"https://api.github.com/repos/projectshft/weather-project/comments{/number}","issue_comment_url":"https://api.github.com/repos/projectshft/weather-project/issues/comments{/number}","contents_url":"https://api.github.com/repos/projectshft/weather-project/contents/{+path}","compare_url":"https://api.github.com/repos/projectshft/weather-project/compare/{base}...{head}","merges_url":"https://api.github.com/repos/projectshft/weather-project/merges","archive_url":"https://api.github.com/repos/projectshft/weather-project/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/projectshft/weather-project/downloads","issues_url":"https://api.github.com/repos/projectshft/weather-project/issues{/number}","pulls_url":"https://api.github.com/repos/projectshft/weather-project/pulls{/number}","milestones_url":"https://api.github.com/repos/projectshft/weather-project/milestones{/number}","notifications_url":"https://api.github.com/repos/projectshft/weather-project/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/projectshft/weather-project/labels{/name}","releases_url":"https://api.github.com/repos/projectshft/weather-project/releases{/id}","deployments_url":"https://api.github.com/repos/projectshft/weather-project/deployments","created_at":"2017-12-26T16:52:45Z","updated_at":"2018-01-29T14:25:28Z","pushed_at":"2018-02-02T14:44:04Z","git_url":"git://github.com/projectshft/weather-project.git","ssh_url":"git@github.com:projectshft/weather-project.git","clone_url":"https://github.com/projectshft/weather-project.git","svn_url":"https://github.com/projectshft/weather-project","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"archived":false,"open_issues_count":7,"license":null,"forks":7,"open_issues":7,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/projectshft/weather-project/pulls/6"},"html":{"href":"https://github.com/projectshft/weather-project/pull/6"},"issue":{"href":"https://api.github.com/repos/projectshft/weather-project/issues/6"},"comments":{"href":"https://api.github.com/repos/projectshft/weather-project/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/projectshft/weather-project/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/projectshft/weather-project/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/projectshft/weather-project/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/projectshft/weather-project/statuses/9d27628c22f571fd19a38e2cc74a990c14d3fd95"}},"author_association":"NONE"}}
{"actor":{"display_login":"amhayslip"}}