{"action":"created","comment":{"url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/pulls/comments/63279364","id":63279364,"diff_hunk":"@@ -43,21 +48,48 @@ BatteryStateOfChargeService::~BatteryStateOfChargeService()\n \n double BatteryStateOfChargeService::totalAmpHoursUsed() const\n {\n-    return 0.0;\n+    return totalCurrent_;\n }\n \n bool BatteryStateOfChargeService::isCharging() const\n {\n-    return false;\n+    if (newCurrent_ <= 0)\n+    {\n+        return true;\n+    }\n+    else\n+    {\n+        return false;\n+    }\n }\n \n QTime BatteryStateOfChargeService::timeWhenChargedOrDepleted() const\n {\n-    return QTime::currentTime();\n+    return estimatedTime_;\n }\n \n void BatteryStateOfChargeService::addData(const BatteryData& batteryData)\n-{\n-    Q_UNUSED(batteryData);\n-    // Update your variables here.\n+{   \n+\n+    QTime newTime = batteryData.time;\n+    QTime oldTime = newTime;\n+    double new_Time = QTime(0, 0, 0).secsTo(newTime);\n+    double old_Time = QTime(0, 0, 0).secsTo(oldTime);\n+    int TimeUsed = new_Time - old_Time;\n+\n+    newCurrent_ = batteryData.current;\n+    double oldCurrent = 0;\n+    totalCurrent_ = newCurrent_ - oldCurrent;\n+    double Average = (newCurrent_ + oldCurrent) * SECONDS_TO_HOURS / TimeUsed;\n+\n+    int timeNeeded =(BATTERY_AMP_HOUR_CAPACITY - newCurrent_) * SECONDS_TO_HOURS / Average;\n+    new_Time = new_Time + timeNeeded;\n+\n+    int Hour = new_Time / SECONDS_TO_HOURS;\n+    int Minute = (new_Time - (Hour * SECONDS_TO_HOURS)) / SECONDS_TO_MINUTES;\n+    int Second = new_Time - (Hour * SECONDS_TO_HOURS) - (Minute * SECONDS_TO_MINUTES);\n+    estimatedTime_ = QTime(Hour, Minute, Second);","path":"src/BatteryStateOfChargeService.cpp","position":70,"original_position":70,"commit_id":"d0f3efbc735414ebe07b195073ad6de505a04e85","original_commit_id":"d0f3efbc735414ebe07b195073ad6de505a04e85","user":{"login":"ikazuka36","id":17913227,"avatar_url":"https://avatars.githubusercontent.com/u/17913227?v=3","gravatar_id":"","url":"https://api.github.com/users/ikazuka36","html_url":"https://github.com/ikazuka36","followers_url":"https://api.github.com/users/ikazuka36/followers","following_url":"https://api.github.com/users/ikazuka36/following{/other_user}","gists_url":"https://api.github.com/users/ikazuka36/gists{/gist_id}","starred_url":"https://api.github.com/users/ikazuka36/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ikazuka36/subscriptions","organizations_url":"https://api.github.com/users/ikazuka36/orgs","repos_url":"https://api.github.com/users/ikazuka36/repos","events_url":"https://api.github.com/users/ikazuka36/events{/privacy}","received_events_url":"https://api.github.com/users/ikazuka36/received_events","type":"User","site_admin":false},"body":"I had it in second so I'd use addSecs instead ","created_at":"2016-05-14T17:28:21Z","updated_at":"2016-05-14T17:28:21Z","html_url":"https://github.com/UCSolarCarTeam/Recruit-Training/pull/12#discussion_r63279364","pull_request_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/pulls/comments/63279364"},"html":{"href":"https://github.com/UCSolarCarTeam/Recruit-Training/pull/12#discussion_r63279364"},"pull_request":{"href":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/pulls/12","id":65892935,"html_url":"https://github.com/UCSolarCarTeam/Recruit-Training/pull/12","diff_url":"https://github.com/UCSolarCarTeam/Recruit-Training/pull/12.diff","patch_url":"https://github.com/UCSolarCarTeam/Recruit-Training/pull/12.patch","issue_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/issues/12","number":12,"state":"open","locked":false,"title":"initial commit","user":{"login":"ikazuka36","id":17913227,"avatar_url":"https://avatars.githubusercontent.com/u/17913227?v=3","gravatar_id":"","url":"https://api.github.com/users/ikazuka36","html_url":"https://github.com/ikazuka36","followers_url":"https://api.github.com/users/ikazuka36/followers","following_url":"https://api.github.com/users/ikazuka36/following{/other_user}","gists_url":"https://api.github.com/users/ikazuka36/gists{/gist_id}","starred_url":"https://api.github.com/users/ikazuka36/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ikazuka36/subscriptions","organizations_url":"https://api.github.com/users/ikazuka36/orgs","repos_url":"https://api.github.com/users/ikazuka36/repos","events_url":"https://api.github.com/users/ikazuka36/events{/privacy}","received_events_url":"https://api.github.com/users/ikazuka36/received_events","type":"User","site_admin":false},"body":"create pull request","created_at":"2016-04-09T21:23:14Z","updated_at":"2016-05-14T17:28:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bfbc4ce93e10e7a265ec222258906db404aabf35","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/pulls/12/commits","review_comments_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/pulls/12/comments","review_comment_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/pulls/comments{/number}","comments_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/issues/12/comments","statuses_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/statuses/d0f3efbc735414ebe07b195073ad6de505a04e85","head":{"label":"UCSolarCarTeam:QuangHuy","ref":"QuangHuy","sha":"d0f3efbc735414ebe07b195073ad6de505a04e85","user":{"login":"UCSolarCarTeam","id":14067129,"avatar_url":"https://avatars.githubusercontent.com/u/14067129?v=3","gravatar_id":"","url":"https://api.github.com/users/UCSolarCarTeam","html_url":"https://github.com/UCSolarCarTeam","followers_url":"https://api.github.com/users/UCSolarCarTeam/followers","following_url":"https://api.github.com/users/UCSolarCarTeam/following{/other_user}","gists_url":"https://api.github.com/users/UCSolarCarTeam/gists{/gist_id}","starred_url":"https://api.github.com/users/UCSolarCarTeam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UCSolarCarTeam/subscriptions","organizations_url":"https://api.github.com/users/UCSolarCarTeam/orgs","repos_url":"https://api.github.com/users/UCSolarCarTeam/repos","events_url":"https://api.github.com/users/UCSolarCarTeam/events{/privacy}","received_events_url":"https://api.github.com/users/UCSolarCarTeam/received_events","type":"Organization","site_admin":false},"repo":{"id":44296946,"name":"Recruit-Training","full_name":"UCSolarCarTeam/Recruit-Training","owner":{"login":"UCSolarCarTeam","id":14067129,"avatar_url":"https://avatars.githubusercontent.com/u/14067129?v=3","gravatar_id":"","url":"https://api.github.com/users/UCSolarCarTeam","html_url":"https://github.com/UCSolarCarTeam","followers_url":"https://api.github.com/users/UCSolarCarTeam/followers","following_url":"https://api.github.com/users/UCSolarCarTeam/following{/other_user}","gists_url":"https://api.github.com/users/UCSolarCarTeam/gists{/gist_id}","starred_url":"https://api.github.com/users/UCSolarCarTeam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UCSolarCarTeam/subscriptions","organizations_url":"https://api.github.com/users/UCSolarCarTeam/orgs","repos_url":"https://api.github.com/users/UCSolarCarTeam/repos","events_url":"https://api.github.com/users/UCSolarCarTeam/events{/privacy}","received_events_url":"https://api.github.com/users/UCSolarCarTeam/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/UCSolarCarTeam/Recruit-Training","description":"Intro project to learn c++ and QT","fork":false,"url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training","forks_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/forks","keys_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/keys{/key_id}","collaborators_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/teams","hooks_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/hooks","issue_events_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/issues/events{/number}","events_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/events","assignees_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/assignees{/user}","branches_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/branches{/branch}","tags_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/tags","blobs_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/git/refs{/sha}","trees_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/git/trees{/sha}","statuses_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/statuses/{sha}","languages_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/languages","stargazers_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/stargazers","contributors_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/contributors","subscribers_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/subscribers","subscription_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/subscription","commits_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/commits{/sha}","git_commits_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/git/commits{/sha}","comments_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/comments{/number}","issue_comment_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/issues/comments{/number}","contents_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/contents/{+path}","compare_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/compare/{base}...{head}","merges_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/merges","archive_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/downloads","issues_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/issues{/number}","pulls_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/pulls{/number}","milestones_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/milestones{/number}","notifications_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/labels{/name}","releases_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/releases{/id}","deployments_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/deployments","created_at":"2015-10-15T06:02:46Z","updated_at":"2016-02-07T08:37:52Z","pushed_at":"2016-05-07T17:51:16Z","git_url":"git://github.com/UCSolarCarTeam/Recruit-Training.git","ssh_url":"git@github.com:UCSolarCarTeam/Recruit-Training.git","clone_url":"https://github.com/UCSolarCarTeam/Recruit-Training.git","svn_url":"https://github.com/UCSolarCarTeam/Recruit-Training","homepage":null,"size":122,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"UCSolarCarTeam:master","ref":"master","sha":"dbb58bb9c159eecaa7a4c7025748cd2b10bc98fe","user":{"login":"UCSolarCarTeam","id":14067129,"avatar_url":"https://avatars.githubusercontent.com/u/14067129?v=3","gravatar_id":"","url":"https://api.github.com/users/UCSolarCarTeam","html_url":"https://github.com/UCSolarCarTeam","followers_url":"https://api.github.com/users/UCSolarCarTeam/followers","following_url":"https://api.github.com/users/UCSolarCarTeam/following{/other_user}","gists_url":"https://api.github.com/users/UCSolarCarTeam/gists{/gist_id}","starred_url":"https://api.github.com/users/UCSolarCarTeam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UCSolarCarTeam/subscriptions","organizations_url":"https://api.github.com/users/UCSolarCarTeam/orgs","repos_url":"https://api.github.com/users/UCSolarCarTeam/repos","events_url":"https://api.github.com/users/UCSolarCarTeam/events{/privacy}","received_events_url":"https://api.github.com/users/UCSolarCarTeam/received_events","type":"Organization","site_admin":false},"repo":{"id":44296946,"name":"Recruit-Training","full_name":"UCSolarCarTeam/Recruit-Training","owner":{"login":"UCSolarCarTeam","id":14067129,"avatar_url":"https://avatars.githubusercontent.com/u/14067129?v=3","gravatar_id":"","url":"https://api.github.com/users/UCSolarCarTeam","html_url":"https://github.com/UCSolarCarTeam","followers_url":"https://api.github.com/users/UCSolarCarTeam/followers","following_url":"https://api.github.com/users/UCSolarCarTeam/following{/other_user}","gists_url":"https://api.github.com/users/UCSolarCarTeam/gists{/gist_id}","starred_url":"https://api.github.com/users/UCSolarCarTeam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UCSolarCarTeam/subscriptions","organizations_url":"https://api.github.com/users/UCSolarCarTeam/orgs","repos_url":"https://api.github.com/users/UCSolarCarTeam/repos","events_url":"https://api.github.com/users/UCSolarCarTeam/events{/privacy}","received_events_url":"https://api.github.com/users/UCSolarCarTeam/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/UCSolarCarTeam/Recruit-Training","description":"Intro project to learn c++ and QT","fork":false,"url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training","forks_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/forks","keys_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/keys{/key_id}","collaborators_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/teams","hooks_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/hooks","issue_events_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/issues/events{/number}","events_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/events","assignees_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/assignees{/user}","branches_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/branches{/branch}","tags_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/tags","blobs_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/git/refs{/sha}","trees_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/git/trees{/sha}","statuses_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/statuses/{sha}","languages_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/languages","stargazers_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/stargazers","contributors_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/contributors","subscribers_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/subscribers","subscription_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/subscription","commits_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/commits{/sha}","git_commits_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/git/commits{/sha}","comments_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/comments{/number}","issue_comment_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/issues/comments{/number}","contents_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/contents/{+path}","compare_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/compare/{base}...{head}","merges_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/merges","archive_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/downloads","issues_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/issues{/number}","pulls_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/pulls{/number}","milestones_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/milestones{/number}","notifications_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/labels{/name}","releases_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/releases{/id}","deployments_url":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/deployments","created_at":"2015-10-15T06:02:46Z","updated_at":"2016-02-07T08:37:52Z","pushed_at":"2016-05-07T17:51:16Z","git_url":"git://github.com/UCSolarCarTeam/Recruit-Training.git","ssh_url":"git@github.com:UCSolarCarTeam/Recruit-Training.git","clone_url":"https://github.com/UCSolarCarTeam/Recruit-Training.git","svn_url":"https://github.com/UCSolarCarTeam/Recruit-Training","homepage":null,"size":122,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/pulls/12"},"html":{"href":"https://github.com/UCSolarCarTeam/Recruit-Training/pull/12"},"issue":{"href":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/issues/12"},"comments":{"href":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/UCSolarCarTeam/Recruit-Training/statuses/d0f3efbc735414ebe07b195073ad6de505a04e85"}}}}