{"action":"created","comment":{"url":"https://api.github.com/repos/civicrm/civihr/pulls/comments/167297957","pull_request_review_id":95504879,"id":167297957,"diff_hunk":"@@ -691,7 +699,7 @@\n             controller.sections.pending.dataIndex = _.indexBy(controller.sections.pending.data, 'id');\n             testData = {\n               leaveRequest: leaveRequest1,\n-              oldBalanceChange: controller.absenceTypes[leaveRequest1.type_id].balanceChanges.pending,\n+              oldBalanceChange: _.find(controller.absenceTypes, { id: leaveRequest1.type_id }).balanceChanges.pending,","path":"uk.co.compucorp.civicrm.hrleaveandabsences/js/angular/test/shared/components/staff-leave-report.component.spec.js","position":null,"original_position":87,"commit_id":"14d1e9bb777511e6a26fc3bcf6fedb4dd6b1f11a","original_commit_id":"5e8eadecca96a3bfaebf5042988fdb957ba4258f","user":{"login":"igorpavlov","id":3973243,"avatar_url":"https://avatars1.githubusercontent.com/u/3973243?v=4","gravatar_id":"","url":"https://api.github.com/users/igorpavlov","html_url":"https://github.com/igorpavlov","followers_url":"https://api.github.com/users/igorpavlov/followers","following_url":"https://api.github.com/users/igorpavlov/following{/other_user}","gists_url":"https://api.github.com/users/igorpavlov/gists{/gist_id}","starred_url":"https://api.github.com/users/igorpavlov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/igorpavlov/subscriptions","organizations_url":"https://api.github.com/users/igorpavlov/orgs","repos_url":"https://api.github.com/users/igorpavlov/repos","events_url":"https://api.github.com/users/igorpavlov/events{/privacy}","received_events_url":"https://api.github.com/users/igorpavlov/received_events","type":"User","site_admin":false},"body":"Done","created_at":"2018-02-09T17:46:38Z","updated_at":"2018-02-09T17:46:38Z","html_url":"https://github.com/civicrm/civihr/pull/2458#discussion_r167297957","pull_request_url":"https://api.github.com/repos/civicrm/civihr/pulls/2458","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/comments/167297957"},"html":{"href":"https://github.com/civicrm/civihr/pull/2458#discussion_r167297957"},"pull_request":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/2458"}},"in_reply_to_id":167254651},"pull_request":{"url":"https://api.github.com/repos/civicrm/civihr/pulls/2458","id":167941510,"html_url":"https://github.com/civicrm/civihr/pull/2458","diff_url":"https://github.com/civicrm/civihr/pull/2458.diff","patch_url":"https://github.com/civicrm/civihr/pull/2458.patch","issue_url":"https://api.github.com/repos/civicrm/civihr/issues/2458","number":2458,"state":"open","locked":false,"title":"PCHR-3190: Sort Absence Types in Leave Staff Report","user":{"login":"igorpavlov","id":3973243,"avatar_url":"https://avatars1.githubusercontent.com/u/3973243?v=4","gravatar_id":"","url":"https://api.github.com/users/igorpavlov","html_url":"https://github.com/igorpavlov","followers_url":"https://api.github.com/users/igorpavlov/followers","following_url":"https://api.github.com/users/igorpavlov/following{/other_user}","gists_url":"https://api.github.com/users/igorpavlov/gists{/gist_id}","starred_url":"https://api.github.com/users/igorpavlov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/igorpavlov/subscriptions","organizations_url":"https://api.github.com/users/igorpavlov/orgs","repos_url":"https://api.github.com/users/igorpavlov/repos","events_url":"https://api.github.com/users/igorpavlov/events{/privacy}","received_events_url":"https://api.github.com/users/igorpavlov/received_events","type":"User","site_admin":false},"body":"## Overview\r\n\r\nYou can set an order of Absence Types, however, this order is not considered neither in Staff leave Report nor in Leave Request Modal. This PR request fixes this issue.\r\n\r\n![image](https://user-images.githubusercontent.com/3973243/35979999-90534db0-0ce1-11e8-8928-e690c651acfd.png)\r\n\r\n## Before\r\n\r\n![image](https://user-images.githubusercontent.com/3973243/35980099-c87f4e0a-0ce1-11e8-8cec-1e645cfcec54.png)\r\n\r\n![image](https://user-images.githubusercontent.com/3973243/35980127-d85fd3b2-0ce1-11e8-918e-02857818e11f.png)\r\n\r\n\r\n## After\r\n\r\n![image](https://user-images.githubusercontent.com/3973243/35980197-0551fb3e-0ce2-11e8-9c97-85930fb8a10e.png)\r\n\r\n![image](https://user-images.githubusercontent.com/3973243/35980210-0ebe2d14-0ce2-11e8-98ca-d4a6009a091c.png)\r\n\r\n## Technical Details\r\n\r\n### Global Absence Types fetching\r\n\r\n```js\r\n// Absence Type API Service\r\napis.factory('AbsenceTypeAPI', // ...\r\n  return api.extend({\r\n    all: function (params) {\r\n      return this.sendGET('AbsenceType', 'get', _.defaults(params || {},\r\n        { is_active: true, options: { sort: 'weight ASC' } }))\r\n          // ...\r\n```\r\n\r\n### Staff Leave Report\r\n\r\n```js\r\n// Keep absence types as an array, not an object\r\nvm.absenceTypes = [];\r\nvm.absenceTypesFiltered = [];\r\n```\r\nAnd since absence types are now an array...\r\n```html\r\n<tr ng-init=\"absenceType = (report.absenceTypes | filter : { 'id' : request.type_id })[0]\"\r\n```\r\n\r\n## Comments\r\n\r\n### Global Absence Types fetching\r\n\r\nThis change affected 3 extensions: Leave and Absences, Job Contract and Contact Summary.\r\n\r\nThe list of the places is:\r\n- Job Contract Summary\r\n- Job Contract Leave Tab\r\n- Absence Tab Entitlements\r\n- Absence Tab Entitlements Log\r\n- Leave Balance Tab\r\n- Leave Calendar\r\n- Leave Request Modal\r\n- Contact Summary Leave Widget\r\n- Manager Leave Report\r\n- Staff Leave Report\r\n\r\n### Refactoring\r\n\r\nStaff Leave Report was also refactored to remove code duplication.\r\n\r\n### Entitlements bug in the Staff Leave Report\r\n\r\nAlso, a bug with entitlements and future balance was fixed:\r\n\r\n### Before\r\n\r\n![image](https://user-images.githubusercontent.com/3973243/35983337-b4b2e848-0ce9-11e8-9380-089b6205cf71.png)\r\n*Notice 9000h and 9h*\r\n\r\n### After\r\n\r\n![image](https://user-images.githubusercontent.com/3973243/35983402-dacaa21e-0ce9-11e8-85cf-36b6573237e7.png)\r\n*Notice 9000h in both places*\r\n\r\n**This is a regression due to https://github.com/civicrm/civihr/pull/2208**\r\n\r\n-----\r\n✅Manual Tests - passed\r\n✅Jasmine Tests - passed\r\n✅JS distributive files - included\r\n⏹Backstop tests - not needed\r\n⏹CSS distributive files - not needed\r\n⏹PHP Unit Tests - not needed","created_at":"2018-02-08T11:10:13Z","updated_at":"2018-02-09T17:46:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"43bd71a856c7f0e40a4329ae28c2243dadd28544","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":39820927,"url":"https://api.github.com/repos/civicrm/civihr/labels/enhancement","name":"enhancement","color":"84b6eb","default":true},{"id":712229315,"url":"https://api.github.com/repos/civicrm/civihr/labels/ready%20to%20test","name":"ready to test","color":"0052cc","default":false},{"id":785577211,"url":"https://api.github.com/repos/civicrm/civihr/labels/regression","name":"regression","color":"fbca04","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/civicrm/civihr/pulls/2458/commits","review_comments_url":"https://api.github.com/repos/civicrm/civihr/pulls/2458/comments","review_comment_url":"https://api.github.com/repos/civicrm/civihr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/civicrm/civihr/issues/2458/comments","statuses_url":"https://api.github.com/repos/civicrm/civihr/statuses/14d1e9bb777511e6a26fc3bcf6fedb4dd6b1f11a","head":{"label":"civicrm:PCHR-3190-order-absence-types-in-staff-report","ref":"PCHR-3190-order-absence-types-in-staff-report","sha":"14d1e9bb777511e6a26fc3bcf6fedb4dd6b1f11a","user":{"login":"civicrm","id":136373,"avatar_url":"https://avatars2.githubusercontent.com/u/136373?v=4","gravatar_id":"","url":"https://api.github.com/users/civicrm","html_url":"https://github.com/civicrm","followers_url":"https://api.github.com/users/civicrm/followers","following_url":"https://api.github.com/users/civicrm/following{/other_user}","gists_url":"https://api.github.com/users/civicrm/gists{/gist_id}","starred_url":"https://api.github.com/users/civicrm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/civicrm/subscriptions","organizations_url":"https://api.github.com/users/civicrm/orgs","repos_url":"https://api.github.com/users/civicrm/repos","events_url":"https://api.github.com/users/civicrm/events{/privacy}","received_events_url":"https://api.github.com/users/civicrm/received_events","type":"Organization","site_admin":false},"repo":{"id":10086903,"name":"civihr","full_name":"civicrm/civihr","owner":{"login":"civicrm","id":136373,"avatar_url":"https://avatars2.githubusercontent.com/u/136373?v=4","gravatar_id":"","url":"https://api.github.com/users/civicrm","html_url":"https://github.com/civicrm","followers_url":"https://api.github.com/users/civicrm/followers","following_url":"https://api.github.com/users/civicrm/following{/other_user}","gists_url":"https://api.github.com/users/civicrm/gists{/gist_id}","starred_url":"https://api.github.com/users/civicrm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/civicrm/subscriptions","organizations_url":"https://api.github.com/users/civicrm/orgs","repos_url":"https://api.github.com/users/civicrm/repos","events_url":"https://api.github.com/users/civicrm/events{/privacy}","received_events_url":"https://api.github.com/users/civicrm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/civicrm/civihr","description":"CiviHR","fork":false,"url":"https://api.github.com/repos/civicrm/civihr","forks_url":"https://api.github.com/repos/civicrm/civihr/forks","keys_url":"https://api.github.com/repos/civicrm/civihr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/civicrm/civihr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/civicrm/civihr/teams","hooks_url":"https://api.github.com/repos/civicrm/civihr/hooks","issue_events_url":"https://api.github.com/repos/civicrm/civihr/issues/events{/number}","events_url":"https://api.github.com/repos/civicrm/civihr/events","assignees_url":"https://api.github.com/repos/civicrm/civihr/assignees{/user}","branches_url":"https://api.github.com/repos/civicrm/civihr/branches{/branch}","tags_url":"https://api.github.com/repos/civicrm/civihr/tags","blobs_url":"https://api.github.com/repos/civicrm/civihr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/civicrm/civihr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/civicrm/civihr/git/refs{/sha}","trees_url":"https://api.github.com/repos/civicrm/civihr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/civicrm/civihr/statuses/{sha}","languages_url":"https://api.github.com/repos/civicrm/civihr/languages","stargazers_url":"https://api.github.com/repos/civicrm/civihr/stargazers","contributors_url":"https://api.github.com/repos/civicrm/civihr/contributors","subscribers_url":"https://api.github.com/repos/civicrm/civihr/subscribers","subscription_url":"https://api.github.com/repos/civicrm/civihr/subscription","commits_url":"https://api.github.com/repos/civicrm/civihr/commits{/sha}","git_commits_url":"https://api.github.com/repos/civicrm/civihr/git/commits{/sha}","comments_url":"https://api.github.com/repos/civicrm/civihr/comments{/number}","issue_comment_url":"https://api.github.com/repos/civicrm/civihr/issues/comments{/number}","contents_url":"https://api.github.com/repos/civicrm/civihr/contents/{+path}","compare_url":"https://api.github.com/repos/civicrm/civihr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/civicrm/civihr/merges","archive_url":"https://api.github.com/repos/civicrm/civihr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/civicrm/civihr/downloads","issues_url":"https://api.github.com/repos/civicrm/civihr/issues{/number}","pulls_url":"https://api.github.com/repos/civicrm/civihr/pulls{/number}","milestones_url":"https://api.github.com/repos/civicrm/civihr/milestones{/number}","notifications_url":"https://api.github.com/repos/civicrm/civihr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/civicrm/civihr/labels{/name}","releases_url":"https://api.github.com/repos/civicrm/civihr/releases{/id}","deployments_url":"https://api.github.com/repos/civicrm/civihr/deployments","created_at":"2013-05-15T20:06:06Z","updated_at":"2018-02-07T06:48:22Z","pushed_at":"2018-02-09T17:46:09Z","git_url":"git://github.com/civicrm/civihr.git","ssh_url":"git@github.com:civicrm/civihr.git","clone_url":"https://github.com/civicrm/civihr.git","svn_url":"https://github.com/civicrm/civihr","homepage":null,"size":60258,"stargazers_count":26,"watchers_count":26,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":37,"mirror_url":null,"archived":false,"open_issues_count":18,"license":null,"forks":37,"open_issues":18,"watchers":26,"default_branch":"staging"}},"base":{"label":"civicrm:staging","ref":"staging","sha":"4d35156c3c04ff71ca4517c19ecd4085af5b43a0","user":{"login":"civicrm","id":136373,"avatar_url":"https://avatars2.githubusercontent.com/u/136373?v=4","gravatar_id":"","url":"https://api.github.com/users/civicrm","html_url":"https://github.com/civicrm","followers_url":"https://api.github.com/users/civicrm/followers","following_url":"https://api.github.com/users/civicrm/following{/other_user}","gists_url":"https://api.github.com/users/civicrm/gists{/gist_id}","starred_url":"https://api.github.com/users/civicrm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/civicrm/subscriptions","organizations_url":"https://api.github.com/users/civicrm/orgs","repos_url":"https://api.github.com/users/civicrm/repos","events_url":"https://api.github.com/users/civicrm/events{/privacy}","received_events_url":"https://api.github.com/users/civicrm/received_events","type":"Organization","site_admin":false},"repo":{"id":10086903,"name":"civihr","full_name":"civicrm/civihr","owner":{"login":"civicrm","id":136373,"avatar_url":"https://avatars2.githubusercontent.com/u/136373?v=4","gravatar_id":"","url":"https://api.github.com/users/civicrm","html_url":"https://github.com/civicrm","followers_url":"https://api.github.com/users/civicrm/followers","following_url":"https://api.github.com/users/civicrm/following{/other_user}","gists_url":"https://api.github.com/users/civicrm/gists{/gist_id}","starred_url":"https://api.github.com/users/civicrm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/civicrm/subscriptions","organizations_url":"https://api.github.com/users/civicrm/orgs","repos_url":"https://api.github.com/users/civicrm/repos","events_url":"https://api.github.com/users/civicrm/events{/privacy}","received_events_url":"https://api.github.com/users/civicrm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/civicrm/civihr","description":"CiviHR","fork":false,"url":"https://api.github.com/repos/civicrm/civihr","forks_url":"https://api.github.com/repos/civicrm/civihr/forks","keys_url":"https://api.github.com/repos/civicrm/civihr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/civicrm/civihr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/civicrm/civihr/teams","hooks_url":"https://api.github.com/repos/civicrm/civihr/hooks","issue_events_url":"https://api.github.com/repos/civicrm/civihr/issues/events{/number}","events_url":"https://api.github.com/repos/civicrm/civihr/events","assignees_url":"https://api.github.com/repos/civicrm/civihr/assignees{/user}","branches_url":"https://api.github.com/repos/civicrm/civihr/branches{/branch}","tags_url":"https://api.github.com/repos/civicrm/civihr/tags","blobs_url":"https://api.github.com/repos/civicrm/civihr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/civicrm/civihr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/civicrm/civihr/git/refs{/sha}","trees_url":"https://api.github.com/repos/civicrm/civihr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/civicrm/civihr/statuses/{sha}","languages_url":"https://api.github.com/repos/civicrm/civihr/languages","stargazers_url":"https://api.github.com/repos/civicrm/civihr/stargazers","contributors_url":"https://api.github.com/repos/civicrm/civihr/contributors","subscribers_url":"https://api.github.com/repos/civicrm/civihr/subscribers","subscription_url":"https://api.github.com/repos/civicrm/civihr/subscription","commits_url":"https://api.github.com/repos/civicrm/civihr/commits{/sha}","git_commits_url":"https://api.github.com/repos/civicrm/civihr/git/commits{/sha}","comments_url":"https://api.github.com/repos/civicrm/civihr/comments{/number}","issue_comment_url":"https://api.github.com/repos/civicrm/civihr/issues/comments{/number}","contents_url":"https://api.github.com/repos/civicrm/civihr/contents/{+path}","compare_url":"https://api.github.com/repos/civicrm/civihr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/civicrm/civihr/merges","archive_url":"https://api.github.com/repos/civicrm/civihr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/civicrm/civihr/downloads","issues_url":"https://api.github.com/repos/civicrm/civihr/issues{/number}","pulls_url":"https://api.github.com/repos/civicrm/civihr/pulls{/number}","milestones_url":"https://api.github.com/repos/civicrm/civihr/milestones{/number}","notifications_url":"https://api.github.com/repos/civicrm/civihr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/civicrm/civihr/labels{/name}","releases_url":"https://api.github.com/repos/civicrm/civihr/releases{/id}","deployments_url":"https://api.github.com/repos/civicrm/civihr/deployments","created_at":"2013-05-15T20:06:06Z","updated_at":"2018-02-07T06:48:22Z","pushed_at":"2018-02-09T17:46:09Z","git_url":"git://github.com/civicrm/civihr.git","ssh_url":"git@github.com:civicrm/civihr.git","clone_url":"https://github.com/civicrm/civihr.git","svn_url":"https://github.com/civicrm/civihr","homepage":null,"size":60258,"stargazers_count":26,"watchers_count":26,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":37,"mirror_url":null,"archived":false,"open_issues_count":18,"license":null,"forks":37,"open_issues":18,"watchers":26,"default_branch":"staging"}},"_links":{"self":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/2458"},"html":{"href":"https://github.com/civicrm/civihr/pull/2458"},"issue":{"href":"https://api.github.com/repos/civicrm/civihr/issues/2458"},"comments":{"href":"https://api.github.com/repos/civicrm/civihr/issues/2458/comments"},"review_comments":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/2458/comments"},"review_comment":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/2458/commits"},"statuses":{"href":"https://api.github.com/repos/civicrm/civihr/statuses/14d1e9bb777511e6a26fc3bcf6fedb4dd6b1f11a"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"igorpavlov"}}