{"action":"created","comment":{"url":"https://api.github.com/repos/ga-dc/atm/pulls/comments/34514795","id":34514795,"diff_hunk":"@@ -1,21 +1,59 @@\n-var checkingBalance = document.querySelector(\"div#checking_balance\");\n-checkingBalance = parseInt( checkingBalance.innerHTML.replace(\"$\", \"\") );\n-\n-var checkingDeposit = function(amount){\n-  checkingBalance = parseInt( checkingBalance.innerHTML.replace(\"$\", \"\") );\n-\n+var checkingBalance = $(\"#checking_balance\").html();\n+\n+function checkingDeposit(){\n+  if (!isNaN(parseInt($(\"#checkingInput\").val()))){\n+    var newDeposit = parseInt($(\"#checkingInput\").val());\n+    var balance = parseInt($(\"#checking_balance\").html().replace(\"$\",\"\"));\n+    var newBalance = newDeposit + balance;\n+    $(\"#checking_balance\").text(\"$\" + newBalance);\n+    $(\"#checking_balance\").removeClass(\"zero\");\n+    $(\"#checkingInput\").val(\"\");\n+ }\n }\n \n-function checkingWithdrawal(amount){\n \n+function checkingWithdrawal(){\n+  var newWithdrawal = parseInt($(\"#checkingInput\").val());\n+  var balance = parseInt($(\"#checking_balance\").html().replace(\"$\",\"\"));\n+  var savingsBalance = parseInt($(\"#savings_balance\").html().replace(\"$\",\"\"));\n+  var totalBalance = balance + savingsBalance;\n+  if( newWithdrawal < balance ){\n+    var newBalance = balance - newWithdrawal;\n+    $(\"#checking_balance\").text(\"$\" + newBalance);\n+  } else if ( newWithdrawal <= totalBalance){\n+    $(\"#checking_balance\").text(\"$0\");\n+    $(\"#checking_balance\").addClass(\"zero\");\n+    var newBalance = totalBalance - newWithdrawal;\n+    $(\"#savings_balance\").text(\"$\" + newBalance);\n+  }","path":"atm.js","position":35,"original_position":35,"commit_id":"bee63a4348a4cb4f326c80d87f06604ed7017126","original_commit_id":"bee63a4348a4cb4f326c80d87f06604ed7017126","user":{"login":"adambray","id":75565,"avatar_url":"https://avatars.githubusercontent.com/u/75565?v=3","gravatar_id":"","url":"https://api.github.com/users/adambray","html_url":"https://github.com/adambray","followers_url":"https://api.github.com/users/adambray/followers","following_url":"https://api.github.com/users/adambray/following{/other_user}","gists_url":"https://api.github.com/users/adambray/gists{/gist_id}","starred_url":"https://api.github.com/users/adambray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adambray/subscriptions","organizations_url":"https://api.github.com/users/adambray/orgs","repos_url":"https://api.github.com/users/adambray/repos","events_url":"https://api.github.com/users/adambray/events{/privacy}","received_events_url":"https://api.github.com/users/adambray/received_events","type":"User","site_admin":false},"body":"Probably want to handle the `else` case here by notifying that the withdrawal couldn't be made due to not enough in savings + checking!","created_at":"2015-07-13T21:34:49Z","updated_at":"2015-07-13T21:34:49Z","html_url":"https://github.com/ga-dc/atm/pull/5#discussion_r34514795","pull_request_url":"https://api.github.com/repos/ga-dc/atm/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/ga-dc/atm/pulls/comments/34514795"},"html":{"href":"https://github.com/ga-dc/atm/pull/5#discussion_r34514795"},"pull_request":{"href":"https://api.github.com/repos/ga-dc/atm/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/ga-dc/atm/pulls/5","id":39633081,"html_url":"https://github.com/ga-dc/atm/pull/5","diff_url":"https://github.com/ga-dc/atm/pull/5.diff","patch_url":"https://github.com/ga-dc/atm/pull/5.patch","issue_url":"https://api.github.com/repos/ga-dc/atm/issues/5","number":5,"state":"open","locked":false,"title":"Jared solution","user":{"login":"arkinjb","id":12718947,"avatar_url":"https://avatars.githubusercontent.com/u/12718947?v=3","gravatar_id":"","url":"https://api.github.com/users/arkinjb","html_url":"https://github.com/arkinjb","followers_url":"https://api.github.com/users/arkinjb/followers","following_url":"https://api.github.com/users/arkinjb/following{/other_user}","gists_url":"https://api.github.com/users/arkinjb/gists{/gist_id}","starred_url":"https://api.github.com/users/arkinjb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arkinjb/subscriptions","organizations_url":"https://api.github.com/users/arkinjb/orgs","repos_url":"https://api.github.com/users/arkinjb/repos","events_url":"https://api.github.com/users/arkinjb/events{/privacy}","received_events_url":"https://api.github.com/users/arkinjb/received_events","type":"User","site_admin":false},"body":"comfort_level: 5\r\ncompleteness: 5\r\n\r\ni think this can be done using an object-oriented approach but i'm having trouble getting started. i'll probably start another branch to work on it.\r\n\r\n","created_at":"2015-07-09T21:59:24Z","updated_at":"2015-07-13T21:34:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e4732387651bf38f8850ba6457f11c92e07fe37b","assignee":{"login":"adambray","id":75565,"avatar_url":"https://avatars.githubusercontent.com/u/75565?v=3","gravatar_id":"","url":"https://api.github.com/users/adambray","html_url":"https://github.com/adambray","followers_url":"https://api.github.com/users/adambray/followers","following_url":"https://api.github.com/users/adambray/following{/other_user}","gists_url":"https://api.github.com/users/adambray/gists{/gist_id}","starred_url":"https://api.github.com/users/adambray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adambray/subscriptions","organizations_url":"https://api.github.com/users/adambray/orgs","repos_url":"https://api.github.com/users/adambray/repos","events_url":"https://api.github.com/users/adambray/events{/privacy}","received_events_url":"https://api.github.com/users/adambray/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/ga-dc/atm/pulls/5/commits","review_comments_url":"https://api.github.com/repos/ga-dc/atm/pulls/5/comments","review_comment_url":"https://api.github.com/repos/ga-dc/atm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ga-dc/atm/issues/5/comments","statuses_url":"https://api.github.com/repos/ga-dc/atm/statuses/bee63a4348a4cb4f326c80d87f06604ed7017126","head":{"label":"arkinjb:jared_solution","ref":"jared_solution","sha":"bee63a4348a4cb4f326c80d87f06604ed7017126","user":{"login":"arkinjb","id":12718947,"avatar_url":"https://avatars.githubusercontent.com/u/12718947?v=3","gravatar_id":"","url":"https://api.github.com/users/arkinjb","html_url":"https://github.com/arkinjb","followers_url":"https://api.github.com/users/arkinjb/followers","following_url":"https://api.github.com/users/arkinjb/following{/other_user}","gists_url":"https://api.github.com/users/arkinjb/gists{/gist_id}","starred_url":"https://api.github.com/users/arkinjb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arkinjb/subscriptions","organizations_url":"https://api.github.com/users/arkinjb/orgs","repos_url":"https://api.github.com/users/arkinjb/repos","events_url":"https://api.github.com/users/arkinjb/events{/privacy}","received_events_url":"https://api.github.com/users/arkinjb/received_events","type":"User","site_admin":false},"repo":{"id":38776440,"name":"atm","full_name":"arkinjb/atm","owner":{"login":"arkinjb","id":12718947,"avatar_url":"https://avatars.githubusercontent.com/u/12718947?v=3","gravatar_id":"","url":"https://api.github.com/users/arkinjb","html_url":"https://github.com/arkinjb","followers_url":"https://api.github.com/users/arkinjb/followers","following_url":"https://api.github.com/users/arkinjb/following{/other_user}","gists_url":"https://api.github.com/users/arkinjb/gists{/gist_id}","starred_url":"https://api.github.com/users/arkinjb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arkinjb/subscriptions","organizations_url":"https://api.github.com/users/arkinjb/orgs","repos_url":"https://api.github.com/users/arkinjb/repos","events_url":"https://api.github.com/users/arkinjb/events{/privacy}","received_events_url":"https://api.github.com/users/arkinjb/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/arkinjb/atm","description":"[javascript, dom, html, css]","fork":true,"url":"https://api.github.com/repos/arkinjb/atm","forks_url":"https://api.github.com/repos/arkinjb/atm/forks","keys_url":"https://api.github.com/repos/arkinjb/atm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/arkinjb/atm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/arkinjb/atm/teams","hooks_url":"https://api.github.com/repos/arkinjb/atm/hooks","issue_events_url":"https://api.github.com/repos/arkinjb/atm/issues/events{/number}","events_url":"https://api.github.com/repos/arkinjb/atm/events","assignees_url":"https://api.github.com/repos/arkinjb/atm/assignees{/user}","branches_url":"https://api.github.com/repos/arkinjb/atm/branches{/branch}","tags_url":"https://api.github.com/repos/arkinjb/atm/tags","blobs_url":"https://api.github.com/repos/arkinjb/atm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/arkinjb/atm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/arkinjb/atm/git/refs{/sha}","trees_url":"https://api.github.com/repos/arkinjb/atm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/arkinjb/atm/statuses/{sha}","languages_url":"https://api.github.com/repos/arkinjb/atm/languages","stargazers_url":"https://api.github.com/repos/arkinjb/atm/stargazers","contributors_url":"https://api.github.com/repos/arkinjb/atm/contributors","subscribers_url":"https://api.github.com/repos/arkinjb/atm/subscribers","subscription_url":"https://api.github.com/repos/arkinjb/atm/subscription","commits_url":"https://api.github.com/repos/arkinjb/atm/commits{/sha}","git_commits_url":"https://api.github.com/repos/arkinjb/atm/git/commits{/sha}","comments_url":"https://api.github.com/repos/arkinjb/atm/comments{/number}","issue_comment_url":"https://api.github.com/repos/arkinjb/atm/issues/comments{/number}","contents_url":"https://api.github.com/repos/arkinjb/atm/contents/{+path}","compare_url":"https://api.github.com/repos/arkinjb/atm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/arkinjb/atm/merges","archive_url":"https://api.github.com/repos/arkinjb/atm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/arkinjb/atm/downloads","issues_url":"https://api.github.com/repos/arkinjb/atm/issues{/number}","pulls_url":"https://api.github.com/repos/arkinjb/atm/pulls{/number}","milestones_url":"https://api.github.com/repos/arkinjb/atm/milestones{/number}","notifications_url":"https://api.github.com/repos/arkinjb/atm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/arkinjb/atm/labels{/name}","releases_url":"https://api.github.com/repos/arkinjb/atm/releases{/id}","created_at":"2015-07-08T19:54:41Z","updated_at":"2015-07-08T19:54:41Z","pushed_at":"2015-07-09T22:18:24Z","git_url":"git://github.com/arkinjb/atm.git","ssh_url":"git@github.com:arkinjb/atm.git","clone_url":"https://github.com/arkinjb/atm.git","svn_url":"https://github.com/arkinjb/atm","homepage":null,"size":138,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ga-dc:master","ref":"master","sha":"dcd13e5ef5de05f3aad789d798ac2e7edf5b45a7","user":{"login":"ga-dc","id":10747017,"avatar_url":"https://avatars.githubusercontent.com/u/10747017?v=3","gravatar_id":"","url":"https://api.github.com/users/ga-dc","html_url":"https://github.com/ga-dc","followers_url":"https://api.github.com/users/ga-dc/followers","following_url":"https://api.github.com/users/ga-dc/following{/other_user}","gists_url":"https://api.github.com/users/ga-dc/gists{/gist_id}","starred_url":"https://api.github.com/users/ga-dc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ga-dc/subscriptions","organizations_url":"https://api.github.com/users/ga-dc/orgs","repos_url":"https://api.github.com/users/ga-dc/repos","events_url":"https://api.github.com/users/ga-dc/events{/privacy}","received_events_url":"https://api.github.com/users/ga-dc/received_events","type":"Organization","site_admin":false},"repo":{"id":37615907,"name":"atm","full_name":"ga-dc/atm","owner":{"login":"ga-dc","id":10747017,"avatar_url":"https://avatars.githubusercontent.com/u/10747017?v=3","gravatar_id":"","url":"https://api.github.com/users/ga-dc","html_url":"https://github.com/ga-dc","followers_url":"https://api.github.com/users/ga-dc/followers","following_url":"https://api.github.com/users/ga-dc/following{/other_user}","gists_url":"https://api.github.com/users/ga-dc/gists{/gist_id}","starred_url":"https://api.github.com/users/ga-dc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ga-dc/subscriptions","organizations_url":"https://api.github.com/users/ga-dc/orgs","repos_url":"https://api.github.com/users/ga-dc/repos","events_url":"https://api.github.com/users/ga-dc/events{/privacy}","received_events_url":"https://api.github.com/users/ga-dc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ga-dc/atm","description":"[javascript, dom, html, css]","fork":false,"url":"https://api.github.com/repos/ga-dc/atm","forks_url":"https://api.github.com/repos/ga-dc/atm/forks","keys_url":"https://api.github.com/repos/ga-dc/atm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ga-dc/atm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ga-dc/atm/teams","hooks_url":"https://api.github.com/repos/ga-dc/atm/hooks","issue_events_url":"https://api.github.com/repos/ga-dc/atm/issues/events{/number}","events_url":"https://api.github.com/repos/ga-dc/atm/events","assignees_url":"https://api.github.com/repos/ga-dc/atm/assignees{/user}","branches_url":"https://api.github.com/repos/ga-dc/atm/branches{/branch}","tags_url":"https://api.github.com/repos/ga-dc/atm/tags","blobs_url":"https://api.github.com/repos/ga-dc/atm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ga-dc/atm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ga-dc/atm/git/refs{/sha}","trees_url":"https://api.github.com/repos/ga-dc/atm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ga-dc/atm/statuses/{sha}","languages_url":"https://api.github.com/repos/ga-dc/atm/languages","stargazers_url":"https://api.github.com/repos/ga-dc/atm/stargazers","contributors_url":"https://api.github.com/repos/ga-dc/atm/contributors","subscribers_url":"https://api.github.com/repos/ga-dc/atm/subscribers","subscription_url":"https://api.github.com/repos/ga-dc/atm/subscription","commits_url":"https://api.github.com/repos/ga-dc/atm/commits{/sha}","git_commits_url":"https://api.github.com/repos/ga-dc/atm/git/commits{/sha}","comments_url":"https://api.github.com/repos/ga-dc/atm/comments{/number}","issue_comment_url":"https://api.github.com/repos/ga-dc/atm/issues/comments{/number}","contents_url":"https://api.github.com/repos/ga-dc/atm/contents/{+path}","compare_url":"https://api.github.com/repos/ga-dc/atm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ga-dc/atm/merges","archive_url":"https://api.github.com/repos/ga-dc/atm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ga-dc/atm/downloads","issues_url":"https://api.github.com/repos/ga-dc/atm/issues{/number}","pulls_url":"https://api.github.com/repos/ga-dc/atm/pulls{/number}","milestones_url":"https://api.github.com/repos/ga-dc/atm/milestones{/number}","notifications_url":"https://api.github.com/repos/ga-dc/atm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ga-dc/atm/labels{/name}","releases_url":"https://api.github.com/repos/ga-dc/atm/releases{/id}","created_at":"2015-06-17T19:21:59Z","updated_at":"2015-07-08T13:35:57Z","pushed_at":"2015-07-13T12:49:17Z","git_url":"git://github.com/ga-dc/atm.git","ssh_url":"git@github.com:ga-dc/atm.git","clone_url":"https://github.com/ga-dc/atm.git","svn_url":"https://github.com/ga-dc/atm","homepage":null,"size":1656,"stargazers_count":1,"watchers_count":1,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":51,"mirror_url":null,"open_issues_count":26,"forks":51,"open_issues":26,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ga-dc/atm/pulls/5"},"html":{"href":"https://github.com/ga-dc/atm/pull/5"},"issue":{"href":"https://api.github.com/repos/ga-dc/atm/issues/5"},"comments":{"href":"https://api.github.com/repos/ga-dc/atm/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/ga-dc/atm/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/ga-dc/atm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ga-dc/atm/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/ga-dc/atm/statuses/bee63a4348a4cb4f326c80d87f06604ed7017126"}}}}