{"action":"created","comment":{"url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/pulls/comments/56262231","id":56262231,"diff_hunk":"@@ -61,6 +68,19 @@ def total_wages\n       ordinary_wages + additional_wages\n     end\n \n+    def clip_additional_wages_based_on_ceiling(additional_wages)\n+      if additional_wage_ceiling.blank?\n+        additional_wages\n+      else\n+        [additional_wages, calculated_remaining_wage_ceiling].min\n+      end\n+    end\n+\n+    def calculated_remaining_wage_ceiling\n+      max_remaining = additional_wage_ceiling - ytd_ow_subject_to_cpf - capped_ordinary_wages - ytd_additional_wages","path":"lib/singapore_cpf_calculator/base_calculator.rb","position":57,"original_position":57,"commit_id":"b524d5c05e0ed2ad4e2a9a2541571d7fa2f6a2d6","original_commit_id":"9c1ee894535ab5be4f56603cce697e58e3766d96","user":{"login":"bramski","id":421781,"avatar_url":"https://avatars.githubusercontent.com/u/421781?v=3","gravatar_id":"","url":"https://api.github.com/users/bramski","html_url":"https://github.com/bramski","followers_url":"https://api.github.com/users/bramski/followers","following_url":"https://api.github.com/users/bramski/following{/other_user}","gists_url":"https://api.github.com/users/bramski/gists{/gist_id}","starred_url":"https://api.github.com/users/bramski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bramski/subscriptions","organizations_url":"https://api.github.com/users/bramski/orgs","repos_url":"https://api.github.com/users/bramski/repos","events_url":"https://api.github.com/users/bramski/events{/privacy}","received_events_url":"https://api.github.com/users/bramski/received_events","type":"User","site_admin":false},"body":"Yeah there's no projection going on here.  We just keep a running tally","created_at":"2016-03-15T23:59:28Z","updated_at":"2016-03-15T23:59:28Z","html_url":"https://github.com/payrollhero/singapore_cpf_calculator/pull/4#discussion_r56262231","pull_request_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/pulls/comments/56262231"},"html":{"href":"https://github.com/payrollhero/singapore_cpf_calculator/pull/4#discussion_r56262231"},"pull_request":{"href":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/pulls/4","id":62835601,"html_url":"https://github.com/payrollhero/singapore_cpf_calculator/pull/4","diff_url":"https://github.com/payrollhero/singapore_cpf_calculator/pull/4.diff","patch_url":"https://github.com/payrollhero/singapore_cpf_calculator/pull/4.patch","issue_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/issues/4","number":4,"state":"open","locked":false,"title":"Upgrade the cpf calculator to use the CPF ceiling for additional wages.","user":{"login":"bramski","id":421781,"avatar_url":"https://avatars.githubusercontent.com/u/421781?v=3","gravatar_id":"","url":"https://api.github.com/users/bramski","html_url":"https://github.com/bramski","followers_url":"https://api.github.com/users/bramski/followers","following_url":"https://api.github.com/users/bramski/following{/other_user}","gists_url":"https://api.github.com/users/bramski/gists{/gist_id}","starred_url":"https://api.github.com/users/bramski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bramski/subscriptions","organizations_url":"https://api.github.com/users/bramski/orgs","repos_url":"https://api.github.com/users/bramski/repos","events_url":"https://api.github.com/users/bramski/events{/privacy}","received_events_url":"https://api.github.com/users/bramski/received_events","type":"User","site_admin":false},"body":"**Feature:**\r\nThis will add the ```ytd_ow_subject_to_cpf``` and ```ytd_additional_wages``` to the calculator where the year's cumulative earnings may be passed.\r\n\r\nIt also now returns ```ow_subject_to_cpf``` and ```aw_subject_to_cpf``` which are the ordinary and additional wages which were subject to cpf.  These must be tracked and passed into the calculator for continuing yearly payroll.\r\n\r\n**Ticket:**\r\nhttps://payrollhero5161.leankit.com/Boards/View/253241089/279860052/310977481\r\n\r\n**Submitter Checklist:**\r\n- [ ] CI Passing\r\n- [ ] No Code Climate Issues\r\n- [ ] Class, Module, and public method comments up to spec\r\n\r\n**Reviewer Checklist:**\r\n- [ ] New Code Tested Effectively\r\n- [ ] Code organization meets SOP standards\r\n- [ ] Does this code fulfill the ticket?\r\n\r\n**Only Then:**\r\n- [ ] Move card in Leankit","created_at":"2016-03-14T23:49:45Z","updated_at":"2016-03-15T23:59:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"58b591fe2397503f3e7b907da2abc8dff8cbe334","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/pulls/4/commits","review_comments_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/pulls/4/comments","review_comment_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/pulls/comments{/number}","comments_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/issues/4/comments","statuses_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/statuses/b524d5c05e0ed2ad4e2a9a2541571d7fa2f6a2d6","head":{"label":"payrollhero:feature/add-aww-cpf-ceiling","ref":"feature/add-aww-cpf-ceiling","sha":"b524d5c05e0ed2ad4e2a9a2541571d7fa2f6a2d6","user":{"login":"payrollhero","id":1617662,"avatar_url":"https://avatars.githubusercontent.com/u/1617662?v=3","gravatar_id":"","url":"https://api.github.com/users/payrollhero","html_url":"https://github.com/payrollhero","followers_url":"https://api.github.com/users/payrollhero/followers","following_url":"https://api.github.com/users/payrollhero/following{/other_user}","gists_url":"https://api.github.com/users/payrollhero/gists{/gist_id}","starred_url":"https://api.github.com/users/payrollhero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/payrollhero/subscriptions","organizations_url":"https://api.github.com/users/payrollhero/orgs","repos_url":"https://api.github.com/users/payrollhero/repos","events_url":"https://api.github.com/users/payrollhero/events{/privacy}","received_events_url":"https://api.github.com/users/payrollhero/received_events","type":"Organization","site_admin":false},"repo":{"id":26465283,"name":"singapore_cpf_calculator","full_name":"payrollhero/singapore_cpf_calculator","owner":{"login":"payrollhero","id":1617662,"avatar_url":"https://avatars.githubusercontent.com/u/1617662?v=3","gravatar_id":"","url":"https://api.github.com/users/payrollhero","html_url":"https://github.com/payrollhero","followers_url":"https://api.github.com/users/payrollhero/followers","following_url":"https://api.github.com/users/payrollhero/following{/other_user}","gists_url":"https://api.github.com/users/payrollhero/gists{/gist_id}","starred_url":"https://api.github.com/users/payrollhero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/payrollhero/subscriptions","organizations_url":"https://api.github.com/users/payrollhero/orgs","repos_url":"https://api.github.com/users/payrollhero/repos","events_url":"https://api.github.com/users/payrollhero/events{/privacy}","received_events_url":"https://api.github.com/users/payrollhero/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/payrollhero/singapore_cpf_calculator","description":"","fork":false,"url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator","forks_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/forks","keys_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/teams","hooks_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/hooks","issue_events_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/issues/events{/number}","events_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/events","assignees_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/assignees{/user}","branches_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/branches{/branch}","tags_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/tags","blobs_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/git/refs{/sha}","trees_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/statuses/{sha}","languages_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/languages","stargazers_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/stargazers","contributors_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/contributors","subscribers_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/subscribers","subscription_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/subscription","commits_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/commits{/sha}","git_commits_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/git/commits{/sha}","comments_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/comments{/number}","issue_comment_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/issues/comments{/number}","contents_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/contents/{+path}","compare_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/merges","archive_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/downloads","issues_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/issues{/number}","pulls_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/pulls{/number}","milestones_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/milestones{/number}","notifications_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/labels{/name}","releases_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/releases{/id}","deployments_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/deployments","created_at":"2014-11-11T02:09:11Z","updated_at":"2016-02-17T10:04:49Z","pushed_at":"2016-03-15T23:19:35Z","git_url":"git://github.com/payrollhero/singapore_cpf_calculator.git","ssh_url":"git@github.com:payrollhero/singapore_cpf_calculator.git","clone_url":"https://github.com/payrollhero/singapore_cpf_calculator.git","svn_url":"https://github.com/payrollhero/singapore_cpf_calculator","homepage":null,"size":138,"stargazers_count":7,"watchers_count":7,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":7,"default_branch":"master"}},"base":{"label":"payrollhero:master","ref":"master","sha":"83d9782644d14b81eafbe614bf7011ee835cc1d3","user":{"login":"payrollhero","id":1617662,"avatar_url":"https://avatars.githubusercontent.com/u/1617662?v=3","gravatar_id":"","url":"https://api.github.com/users/payrollhero","html_url":"https://github.com/payrollhero","followers_url":"https://api.github.com/users/payrollhero/followers","following_url":"https://api.github.com/users/payrollhero/following{/other_user}","gists_url":"https://api.github.com/users/payrollhero/gists{/gist_id}","starred_url":"https://api.github.com/users/payrollhero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/payrollhero/subscriptions","organizations_url":"https://api.github.com/users/payrollhero/orgs","repos_url":"https://api.github.com/users/payrollhero/repos","events_url":"https://api.github.com/users/payrollhero/events{/privacy}","received_events_url":"https://api.github.com/users/payrollhero/received_events","type":"Organization","site_admin":false},"repo":{"id":26465283,"name":"singapore_cpf_calculator","full_name":"payrollhero/singapore_cpf_calculator","owner":{"login":"payrollhero","id":1617662,"avatar_url":"https://avatars.githubusercontent.com/u/1617662?v=3","gravatar_id":"","url":"https://api.github.com/users/payrollhero","html_url":"https://github.com/payrollhero","followers_url":"https://api.github.com/users/payrollhero/followers","following_url":"https://api.github.com/users/payrollhero/following{/other_user}","gists_url":"https://api.github.com/users/payrollhero/gists{/gist_id}","starred_url":"https://api.github.com/users/payrollhero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/payrollhero/subscriptions","organizations_url":"https://api.github.com/users/payrollhero/orgs","repos_url":"https://api.github.com/users/payrollhero/repos","events_url":"https://api.github.com/users/payrollhero/events{/privacy}","received_events_url":"https://api.github.com/users/payrollhero/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/payrollhero/singapore_cpf_calculator","description":"","fork":false,"url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator","forks_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/forks","keys_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/teams","hooks_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/hooks","issue_events_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/issues/events{/number}","events_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/events","assignees_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/assignees{/user}","branches_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/branches{/branch}","tags_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/tags","blobs_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/git/refs{/sha}","trees_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/statuses/{sha}","languages_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/languages","stargazers_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/stargazers","contributors_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/contributors","subscribers_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/subscribers","subscription_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/subscription","commits_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/commits{/sha}","git_commits_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/git/commits{/sha}","comments_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/comments{/number}","issue_comment_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/issues/comments{/number}","contents_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/contents/{+path}","compare_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/merges","archive_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/downloads","issues_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/issues{/number}","pulls_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/pulls{/number}","milestones_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/milestones{/number}","notifications_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/labels{/name}","releases_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/releases{/id}","deployments_url":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/deployments","created_at":"2014-11-11T02:09:11Z","updated_at":"2016-02-17T10:04:49Z","pushed_at":"2016-03-15T23:19:35Z","git_url":"git://github.com/payrollhero/singapore_cpf_calculator.git","ssh_url":"git@github.com:payrollhero/singapore_cpf_calculator.git","clone_url":"https://github.com/payrollhero/singapore_cpf_calculator.git","svn_url":"https://github.com/payrollhero/singapore_cpf_calculator","homepage":null,"size":138,"stargazers_count":7,"watchers_count":7,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/pulls/4"},"html":{"href":"https://github.com/payrollhero/singapore_cpf_calculator/pull/4"},"issue":{"href":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/issues/4"},"comments":{"href":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/payrollhero/singapore_cpf_calculator/statuses/b524d5c05e0ed2ad4e2a9a2541571d7fa2f6a2d6"}}}}