{"action":"created","comment":{"url":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/comments/40468473","id":40468473,"diff_hunk":"@@ -0,0 +1,39 @@\n+var TotalCalculator = function(detailsList, orderedItems, subTotal) {\n+  this.detailsList = hipsterCoffeeDetails;\n+  this.orderedItems = orderedItems;\n+  this.subTotal = subTotal;\n+};\n+\n+TotalCalculator.prototype.calculateTotalBill = function () {\n+  var totalBill = this.subTotal;\n+\n+  if(this.subTotal > 50) {\n+    totalBill = this.applyFivePercentDiscount(totalBill);\n+  }\n+  if(this.isMuffinInOrder()) {\n+    totalBill -= this.applyMuffinDiscount();\n+    totalBill = Math.round(totalBill * 100) / 100;\n+  }\n+  return totalBill;\n+};\n+\n+TotalCalculator.prototype.isMuffinInOrder = function() {\n+  return (this.orderedItems.indexOf('Muffin Of The Day') > -1 || this.orderedItems.indexOf('Chocolate Chip Muffin') > -1 || this.orderedItems.indexOf('Blueberry Muffin') > -1);\n+};\n+\n+TotalCalculator.prototype.applyFivePercentDiscount = function(bill) {\n+  var billAfterFivePercentDiscount = bill * 0.95;\n+  return Math.round(billAfterFivePercentDiscount * 100) / 100;\n+};\n+\n+TotalCalculator.prototype.applyMuffinDiscount = function() {\n+  var muffinDiscount = 0;\n+  var items = this.orderedItems;\n+  var details = this.detailsList;\n+  for(var i = 0; i < items.length; i++) {","path":"src/TotalCalculator.js","position":33,"original_position":33,"commit_id":"bcba3524f0a6969515a84ea07556db65d7bb628a","original_commit_id":"bcba3524f0a6969515a84ea07556db65d7bb628a","user":{"login":"spike01","id":7307631,"avatar_url":"https://avatars.githubusercontent.com/u/7307631?v=3","gravatar_id":"","url":"https://api.github.com/users/spike01","html_url":"https://github.com/spike01","followers_url":"https://api.github.com/users/spike01/followers","following_url":"https://api.github.com/users/spike01/following{/other_user}","gists_url":"https://api.github.com/users/spike01/gists{/gist_id}","starred_url":"https://api.github.com/users/spike01/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spike01/subscriptions","organizations_url":"https://api.github.com/users/spike01/orgs","repos_url":"https://api.github.com/users/spike01/repos","events_url":"https://api.github.com/users/spike01/events{/privacy}","received_events_url":"https://api.github.com/users/spike01/received_events","type":"User","site_admin":false},"body":"For loops are fine, but check out Array.prototype.map and Array.prototype.forEach","created_at":"2015-09-25T19:45:27Z","updated_at":"2015-09-25T19:45:27Z","html_url":"https://github.com/makersacademy/till_tech_test/pull/31#discussion_r40468473","pull_request_url":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/31","_links":{"self":{"href":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/comments/40468473"},"html":{"href":"https://github.com/makersacademy/till_tech_test/pull/31#discussion_r40468473"},"pull_request":{"href":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/31"}}},"pull_request":{"url":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/31","id":44566238,"html_url":"https://github.com/makersacademy/till_tech_test/pull/31","diff_url":"https://github.com/makersacademy/till_tech_test/pull/31.diff","patch_url":"https://github.com/makersacademy/till_tech_test/pull/31.patch","issue_url":"https://api.github.com/repos/makersacademy/till_tech_test/issues/31","number":31,"state":"open","locked":false,"title":"JavaScript Till Tech Test up to end of V2","user":{"login":"natstar93","id":10135250,"avatar_url":"https://avatars.githubusercontent.com/u/10135250?v=3","gravatar_id":"","url":"https://api.github.com/users/natstar93","html_url":"https://github.com/natstar93","followers_url":"https://api.github.com/users/natstar93/followers","following_url":"https://api.github.com/users/natstar93/following{/other_user}","gists_url":"https://api.github.com/users/natstar93/gists{/gist_id}","starred_url":"https://api.github.com/users/natstar93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natstar93/subscriptions","organizations_url":"https://api.github.com/users/natstar93/orgs","repos_url":"https://api.github.com/users/natstar93/repos","events_url":"https://api.github.com/users/natstar93/events{/privacy}","received_events_url":"https://api.github.com/users/natstar93/received_events","type":"User","site_admin":false},"body":"\r\n","created_at":"2015-09-09T15:42:36Z","updated_at":"2015-09-25T19:45:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"199758185dd986cb68a893056258cae79f2497b1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/31/commits","review_comments_url":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/31/comments","review_comment_url":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/comments{/number}","comments_url":"https://api.github.com/repos/makersacademy/till_tech_test/issues/31/comments","statuses_url":"https://api.github.com/repos/makersacademy/till_tech_test/statuses/bcba3524f0a6969515a84ea07556db65d7bb628a","head":{"label":"natstar93:master","ref":"master","sha":"bcba3524f0a6969515a84ea07556db65d7bb628a","user":{"login":"natstar93","id":10135250,"avatar_url":"https://avatars.githubusercontent.com/u/10135250?v=3","gravatar_id":"","url":"https://api.github.com/users/natstar93","html_url":"https://github.com/natstar93","followers_url":"https://api.github.com/users/natstar93/followers","following_url":"https://api.github.com/users/natstar93/following{/other_user}","gists_url":"https://api.github.com/users/natstar93/gists{/gist_id}","starred_url":"https://api.github.com/users/natstar93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natstar93/subscriptions","organizations_url":"https://api.github.com/users/natstar93/orgs","repos_url":"https://api.github.com/users/natstar93/repos","events_url":"https://api.github.com/users/natstar93/events{/privacy}","received_events_url":"https://api.github.com/users/natstar93/received_events","type":"User","site_admin":false},"repo":{"id":41434298,"name":"till_tech_test","full_name":"natstar93/till_tech_test","owner":{"login":"natstar93","id":10135250,"avatar_url":"https://avatars.githubusercontent.com/u/10135250?v=3","gravatar_id":"","url":"https://api.github.com/users/natstar93","html_url":"https://github.com/natstar93","followers_url":"https://api.github.com/users/natstar93/followers","following_url":"https://api.github.com/users/natstar93/following{/other_user}","gists_url":"https://api.github.com/users/natstar93/gists{/gist_id}","starred_url":"https://api.github.com/users/natstar93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natstar93/subscriptions","organizations_url":"https://api.github.com/users/natstar93/orgs","repos_url":"https://api.github.com/users/natstar93/repos","events_url":"https://api.github.com/users/natstar93/events{/privacy}","received_events_url":"https://api.github.com/users/natstar93/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/natstar93/till_tech_test","description":"Hiring week tech test","fork":true,"url":"https://api.github.com/repos/natstar93/till_tech_test","forks_url":"https://api.github.com/repos/natstar93/till_tech_test/forks","keys_url":"https://api.github.com/repos/natstar93/till_tech_test/keys{/key_id}","collaborators_url":"https://api.github.com/repos/natstar93/till_tech_test/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/natstar93/till_tech_test/teams","hooks_url":"https://api.github.com/repos/natstar93/till_tech_test/hooks","issue_events_url":"https://api.github.com/repos/natstar93/till_tech_test/issues/events{/number}","events_url":"https://api.github.com/repos/natstar93/till_tech_test/events","assignees_url":"https://api.github.com/repos/natstar93/till_tech_test/assignees{/user}","branches_url":"https://api.github.com/repos/natstar93/till_tech_test/branches{/branch}","tags_url":"https://api.github.com/repos/natstar93/till_tech_test/tags","blobs_url":"https://api.github.com/repos/natstar93/till_tech_test/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/natstar93/till_tech_test/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/natstar93/till_tech_test/git/refs{/sha}","trees_url":"https://api.github.com/repos/natstar93/till_tech_test/git/trees{/sha}","statuses_url":"https://api.github.com/repos/natstar93/till_tech_test/statuses/{sha}","languages_url":"https://api.github.com/repos/natstar93/till_tech_test/languages","stargazers_url":"https://api.github.com/repos/natstar93/till_tech_test/stargazers","contributors_url":"https://api.github.com/repos/natstar93/till_tech_test/contributors","subscribers_url":"https://api.github.com/repos/natstar93/till_tech_test/subscribers","subscription_url":"https://api.github.com/repos/natstar93/till_tech_test/subscription","commits_url":"https://api.github.com/repos/natstar93/till_tech_test/commits{/sha}","git_commits_url":"https://api.github.com/repos/natstar93/till_tech_test/git/commits{/sha}","comments_url":"https://api.github.com/repos/natstar93/till_tech_test/comments{/number}","issue_comment_url":"https://api.github.com/repos/natstar93/till_tech_test/issues/comments{/number}","contents_url":"https://api.github.com/repos/natstar93/till_tech_test/contents/{+path}","compare_url":"https://api.github.com/repos/natstar93/till_tech_test/compare/{base}...{head}","merges_url":"https://api.github.com/repos/natstar93/till_tech_test/merges","archive_url":"https://api.github.com/repos/natstar93/till_tech_test/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/natstar93/till_tech_test/downloads","issues_url":"https://api.github.com/repos/natstar93/till_tech_test/issues{/number}","pulls_url":"https://api.github.com/repos/natstar93/till_tech_test/pulls{/number}","milestones_url":"https://api.github.com/repos/natstar93/till_tech_test/milestones{/number}","notifications_url":"https://api.github.com/repos/natstar93/till_tech_test/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/natstar93/till_tech_test/labels{/name}","releases_url":"https://api.github.com/repos/natstar93/till_tech_test/releases{/id}","created_at":"2015-08-26T15:41:58Z","updated_at":"2015-09-05T23:26:39Z","pushed_at":"2015-09-09T15:14:25Z","git_url":"git://github.com/natstar93/till_tech_test.git","ssh_url":"git@github.com:natstar93/till_tech_test.git","clone_url":"https://github.com/natstar93/till_tech_test.git","svn_url":"https://github.com/natstar93/till_tech_test","homepage":null,"size":232,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"makersacademy:master","ref":"master","sha":"c0f24f5be17a75f978ae982077e968aa2324ab12","user":{"login":"makersacademy","id":3636186,"avatar_url":"https://avatars.githubusercontent.com/u/3636186?v=3","gravatar_id":"","url":"https://api.github.com/users/makersacademy","html_url":"https://github.com/makersacademy","followers_url":"https://api.github.com/users/makersacademy/followers","following_url":"https://api.github.com/users/makersacademy/following{/other_user}","gists_url":"https://api.github.com/users/makersacademy/gists{/gist_id}","starred_url":"https://api.github.com/users/makersacademy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/makersacademy/subscriptions","organizations_url":"https://api.github.com/users/makersacademy/orgs","repos_url":"https://api.github.com/users/makersacademy/repos","events_url":"https://api.github.com/users/makersacademy/events{/privacy}","received_events_url":"https://api.github.com/users/makersacademy/received_events","type":"Organization","site_admin":false},"repo":{"id":31914698,"name":"till_tech_test","full_name":"makersacademy/till_tech_test","owner":{"login":"makersacademy","id":3636186,"avatar_url":"https://avatars.githubusercontent.com/u/3636186?v=3","gravatar_id":"","url":"https://api.github.com/users/makersacademy","html_url":"https://github.com/makersacademy","followers_url":"https://api.github.com/users/makersacademy/followers","following_url":"https://api.github.com/users/makersacademy/following{/other_user}","gists_url":"https://api.github.com/users/makersacademy/gists{/gist_id}","starred_url":"https://api.github.com/users/makersacademy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/makersacademy/subscriptions","organizations_url":"https://api.github.com/users/makersacademy/orgs","repos_url":"https://api.github.com/users/makersacademy/repos","events_url":"https://api.github.com/users/makersacademy/events{/privacy}","received_events_url":"https://api.github.com/users/makersacademy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/makersacademy/till_tech_test","description":"Hiring week tech test","fork":false,"url":"https://api.github.com/repos/makersacademy/till_tech_test","forks_url":"https://api.github.com/repos/makersacademy/till_tech_test/forks","keys_url":"https://api.github.com/repos/makersacademy/till_tech_test/keys{/key_id}","collaborators_url":"https://api.github.com/repos/makersacademy/till_tech_test/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/makersacademy/till_tech_test/teams","hooks_url":"https://api.github.com/repos/makersacademy/till_tech_test/hooks","issue_events_url":"https://api.github.com/repos/makersacademy/till_tech_test/issues/events{/number}","events_url":"https://api.github.com/repos/makersacademy/till_tech_test/events","assignees_url":"https://api.github.com/repos/makersacademy/till_tech_test/assignees{/user}","branches_url":"https://api.github.com/repos/makersacademy/till_tech_test/branches{/branch}","tags_url":"https://api.github.com/repos/makersacademy/till_tech_test/tags","blobs_url":"https://api.github.com/repos/makersacademy/till_tech_test/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/makersacademy/till_tech_test/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/makersacademy/till_tech_test/git/refs{/sha}","trees_url":"https://api.github.com/repos/makersacademy/till_tech_test/git/trees{/sha}","statuses_url":"https://api.github.com/repos/makersacademy/till_tech_test/statuses/{sha}","languages_url":"https://api.github.com/repos/makersacademy/till_tech_test/languages","stargazers_url":"https://api.github.com/repos/makersacademy/till_tech_test/stargazers","contributors_url":"https://api.github.com/repos/makersacademy/till_tech_test/contributors","subscribers_url":"https://api.github.com/repos/makersacademy/till_tech_test/subscribers","subscription_url":"https://api.github.com/repos/makersacademy/till_tech_test/subscription","commits_url":"https://api.github.com/repos/makersacademy/till_tech_test/commits{/sha}","git_commits_url":"https://api.github.com/repos/makersacademy/till_tech_test/git/commits{/sha}","comments_url":"https://api.github.com/repos/makersacademy/till_tech_test/comments{/number}","issue_comment_url":"https://api.github.com/repos/makersacademy/till_tech_test/issues/comments{/number}","contents_url":"https://api.github.com/repos/makersacademy/till_tech_test/contents/{+path}","compare_url":"https://api.github.com/repos/makersacademy/till_tech_test/compare/{base}...{head}","merges_url":"https://api.github.com/repos/makersacademy/till_tech_test/merges","archive_url":"https://api.github.com/repos/makersacademy/till_tech_test/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/makersacademy/till_tech_test/downloads","issues_url":"https://api.github.com/repos/makersacademy/till_tech_test/issues{/number}","pulls_url":"https://api.github.com/repos/makersacademy/till_tech_test/pulls{/number}","milestones_url":"https://api.github.com/repos/makersacademy/till_tech_test/milestones{/number}","notifications_url":"https://api.github.com/repos/makersacademy/till_tech_test/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/makersacademy/till_tech_test/labels{/name}","releases_url":"https://api.github.com/repos/makersacademy/till_tech_test/releases{/id}","created_at":"2015-03-09T18:16:02Z","updated_at":"2015-06-11T11:34:30Z","pushed_at":"2015-09-23T18:03:36Z","git_url":"git://github.com/makersacademy/till_tech_test.git","ssh_url":"git@github.com:makersacademy/till_tech_test.git","clone_url":"https://github.com/makersacademy/till_tech_test.git","svn_url":"https://github.com/makersacademy/till_tech_test","homepage":null,"size":52512,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":58,"mirror_url":null,"open_issues_count":26,"forks":58,"open_issues":26,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/31"},"html":{"href":"https://github.com/makersacademy/till_tech_test/pull/31"},"issue":{"href":"https://api.github.com/repos/makersacademy/till_tech_test/issues/31"},"comments":{"href":"https://api.github.com/repos/makersacademy/till_tech_test/issues/31/comments"},"review_comments":{"href":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/31/comments"},"review_comment":{"href":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/makersacademy/till_tech_test/pulls/31/commits"},"statuses":{"href":"https://api.github.com/repos/makersacademy/till_tech_test/statuses/bcba3524f0a6969515a84ea07556db65d7bb628a"}}}}