{"action":"created","comment":{"url":"https://api.github.com/repos/civicrm/civihr/pulls/comments/80919492","pull_request_review_id":1938030,"id":80919492,"diff_hunk":"@@ -14,37 +15,52 @@ define([\n    * @param {ContractService} Contract\n    * @constructor\n    */\n-  function KeyDetailsCtrl($log, ContactDetails, Contract) {\n+  function KeyDetailsCtrl($log, ContactDetails, Contract, pubSubService) {\n     $log.debug('Controller: KeyDetailsCtrl');\n \n     this.ready = false;\n \n-    ContactDetails.get()\n-      .then(function (response) {\n-        this.contactDetails = response;\n-        return Contract.getPrimary();\n-      }.bind(this))\n-      .then(function (response) {\n-        if (_.isEmpty(response)) {\n-          return;\n+\n+\n+    var getContacts = function(){","path":"contactsummary/js/src/contact-summary/controllers/keyDetails.js","position":null,"original_position":30,"commit_id":"341ade2f60793e5fa662229687dd9ccb53c2a187","original_commit_id":"2f947c69b66c42203ab1a9e0150eedcff898b531","user":{"login":"deb1990","id":5058867,"avatar_url":"https://avatars.githubusercontent.com/u/5058867?v=3","gravatar_id":"","url":"https://api.github.com/users/deb1990","html_url":"https://github.com/deb1990","followers_url":"https://api.github.com/users/deb1990/followers","following_url":"https://api.github.com/users/deb1990/following{/other_user}","gists_url":"https://api.github.com/users/deb1990/gists{/gist_id}","starred_url":"https://api.github.com/users/deb1990/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deb1990/subscriptions","organizations_url":"https://api.github.com/users/deb1990/orgs","repos_url":"https://api.github.com/users/deb1990/repos","events_url":"https://api.github.com/users/deb1990/events{/privacy}","received_events_url":"https://api.github.com/users/deb1990/received_events","type":"User","site_admin":false},"body":"I used first one so that bind can be used. Otherwise another line would be needed to bind\r\n``` \r\nfunction getContacts() {}\r\ngetContacts.bind(this);\r\n```","created_at":"2016-09-28T13:49:18Z","updated_at":"2016-09-28T13:49:18Z","html_url":"https://github.com/civicrm/civihr/pull/1156#discussion_r80919492","pull_request_url":"https://api.github.com/repos/civicrm/civihr/pulls/1156","_links":{"self":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/comments/80919492"},"html":{"href":"https://github.com/civicrm/civihr/pull/1156#discussion_r80919492"},"pull_request":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/1156"}}},"pull_request":{"url":"https://api.github.com/repos/civicrm/civihr/pulls/1156","id":85078282,"html_url":"https://github.com/civicrm/civihr/pull/1156","diff_url":"https://github.com/civicrm/civihr/pull/1156.diff","patch_url":"https://github.com/civicrm/civihr/pull/1156.patch","issue_url":"https://api.github.com/repos/civicrm/civihr/issues/1156","number":1156,"state":"open","locked":false,"title":"PCHR-1287 - Modifying Contact Summary block to read Length of Service from API entry point instead of latest Job Contract dates. Creating BAO and API changes required by front-end part.","user":{"login":"coldrunKacper","id":8986209,"avatar_url":"https://avatars.githubusercontent.com/u/8986209?v=3","gravatar_id":"","url":"https://api.github.com/users/coldrunKacper","html_url":"https://github.com/coldrunKacper","followers_url":"https://api.github.com/users/coldrunKacper/followers","following_url":"https://api.github.com/users/coldrunKacper/following{/other_user}","gists_url":"https://api.github.com/users/coldrunKacper/gists{/gist_id}","starred_url":"https://api.github.com/users/coldrunKacper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coldrunKacper/subscriptions","organizations_url":"https://api.github.com/users/coldrunKacper/orgs","repos_url":"https://api.github.com/users/coldrunKacper/repos","events_url":"https://api.github.com/users/coldrunKacper/events{/privacy}","received_events_url":"https://api.github.com/users/coldrunKacper/received_events","type":"User","site_admin":false},"body":"A \"Length of Service\" value on \"Contact Summary\" tab was displaying incorrect value as it was calculated on the front-end side depending on latest Job Contract dates.\r\nThings which got changed with this PR:\r\n- Changed Length of Service front-end calculation method so currently it's retrieved by API call and matches \"Personal Details\" tab displaying overall length of service.\r\n- Modified length of service calculation to include both start and end date of service period. Previously for Job Contract starting on 2016-09-01 and ending 2016-09-02 it was returning 1 day which was not correct (should be 2 days). It's fixed now.\r\n- Added new Upgrader function to recalculate Length of Service fields.\r\n- Added unit tests.\r\n\r\n## Javascript:\r\n**Problem**: It was required to send messages between different angular apps(ContactSummary, JobContracts etc) to notify the other about the changes in one app. So that the other can update itself.\r\n\r\n**Solution**\r\nA new service \"pubSubService\" is added, **using which communication between different angular apps can be achieved**. \r\n\r\nHere is how to use it-\r\n**Dependency Injection**\r\n1. Include the file in the define section\r\n2. Inject the service \r\n```javascript\r\ndefine([\r\n  // ...\r\n  'common/services/pub-sub-service'  // inject the service\r\n], function () {\r\n  'use strict';\r\n  function SomeController(/* ... */, pubSubService) {\r\n  }\r\n});\r\n```\r\n\r\n**Subscribing to Events**\r\n```javascript\r\npubSubService.subscribe(\"event_a\",  function(){\r\n//Callback\r\n});\r\n```\r\n\r\n**Publish Events**\r\n```javascript\r\npubSubService.publish(\"event_a\");\r\n```\r\n\r\n\r\nUsing the same service, Contact Summary is getting updated whenever there is a change in Job Contract Tab.","created_at":"2016-09-13T16:08:32Z","updated_at":"2016-09-28T13:49:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0adac2fa657ac25986dbd1a30c80bf3c57a8263f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/civicrm/civihr/pulls/1156/commits","review_comments_url":"https://api.github.com/repos/civicrm/civihr/pulls/1156/comments","review_comment_url":"https://api.github.com/repos/civicrm/civihr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/civicrm/civihr/issues/1156/comments","statuses_url":"https://api.github.com/repos/civicrm/civihr/statuses/341ade2f60793e5fa662229687dd9ccb53c2a187","head":{"label":"civicrm:PCHR-1287-length-of-service-field-contact-summary","ref":"PCHR-1287-length-of-service-field-contact-summary","sha":"341ade2f60793e5fa662229687dd9ccb53c2a187","user":{"login":"civicrm","id":136373,"avatar_url":"https://avatars.githubusercontent.com/u/136373?v=3","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://avatars.githubusercontent.com/u/136373?v=3","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":"2016-06-29T20:52:22Z","pushed_at":"2016-09-28T12:21:01Z","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":26567,"stargazers_count":4,"watchers_count":4,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":23,"mirror_url":null,"open_issues_count":20,"forks":23,"open_issues":20,"watchers":4,"default_branch":"staging"}},"base":{"label":"civicrm:staging","ref":"staging","sha":"27d6b863633146d63f020f6ea487a59515891dad","user":{"login":"civicrm","id":136373,"avatar_url":"https://avatars.githubusercontent.com/u/136373?v=3","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://avatars.githubusercontent.com/u/136373?v=3","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":"2016-06-29T20:52:22Z","pushed_at":"2016-09-28T12:21:01Z","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":26567,"stargazers_count":4,"watchers_count":4,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":23,"mirror_url":null,"open_issues_count":20,"forks":23,"open_issues":20,"watchers":4,"default_branch":"staging"}},"_links":{"self":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/1156"},"html":{"href":"https://github.com/civicrm/civihr/pull/1156"},"issue":{"href":"https://api.github.com/repos/civicrm/civihr/issues/1156"},"comments":{"href":"https://api.github.com/repos/civicrm/civihr/issues/1156/comments"},"review_comments":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/1156/comments"},"review_comment":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/1156/commits"},"statuses":{"href":"https://api.github.com/repos/civicrm/civihr/statuses/341ade2f60793e5fa662229687dd9ccb53c2a187"}}}}
{"actor":{"display_login":"deb1990"}}