{"action":"created","comment":{"url":"https://api.github.com/repos/civicrm/civihr/pulls/comments/93258061","pull_request_review_id":13777439,"id":93258061,"diff_hunk":"@@ -1,101 +1,207 @@\n-define(function () {\n+define([\n+  'mocks/data/option-group-mock-data',\n+  'mocks/data/absence-type-data',\n+], function (optionGroupMock, absenceTypeData) {\n   var mockData = {\n     allData: {\n-      \"is_error\": 0,\n-      \"version\": 3,\n-      \"count\": 6,\n-      \"values\": [\n-        {\n-          \"id\": \"17\",\n-          \"type_id\": \"1\",\n-          \"contact_id\": \"202\",\n-          \"status_id\": \"1\",\n-          \"from_date\": \"2016-02-01\",\n-          \"from_date_type\": \"1\",\n-          \"to_date\": \"2016-02-03\",\n-          \"to_date_type\": \"1\"\n-        },\n-        {\n-          \"id\": \"18\",\n-          \"type_id\": \"1\",\n-          \"contact_id\": \"202\",\n-          \"status_id\": \"1\",\n-          \"from_date\": \"2016-08-17\",\n-          \"from_date_type\": \"1\",\n-          \"to_date\": \"2016-08-25\",\n-          \"to_date_type\": \"1\"\n-        },\n-        {\n-          \"id\": \"19\",\n-          \"type_id\": \"1\",\n-          \"contact_id\": \"202\",\n-          \"status_id\": \"6\",\n-          \"from_date\": \"2016-01-30\",\n-          \"from_date_type\": \"1\",\n-          \"to_date\": \"2016-02-01\",\n-          \"to_date_type\": \"1\"\n-        },\n-        {\n-          \"id\": \"20\",\n-          \"type_id\": \"1\",\n-          \"contact_id\": \"202\",\n-          \"status_id\": \"3\",\n-          \"from_date\": \"2016-11-23\",\n-          \"from_date_type\": \"1\",\n-          \"to_date\": \"2016-11-28\",\n-          \"to_date_type\": \"1\"\n-        },\n-        {\n-          \"id\": \"21\",\n-          \"type_id\": \"3\",\n-          \"contact_id\": \"202\",\n-          \"status_id\": \"5\",\n-          \"from_date\": \"2016-06-03\",\n-          \"from_date_type\": \"1\",\n-          \"to_date\": \"2016-06-13\",\n-          \"to_date_type\": \"1\"\n-        },\n-        {\n-          \"id\": \"22\",\n-          \"type_id\": \"2\",\n-          \"contact_id\": \"202\",\n-          \"status_id\": \"4\",\n-          \"from_date\": \"2016-01-01\",\n-          \"from_date_type\": \"1\",\n-          \"to_date\": \"2016-01-01\",\n-          \"to_date_type\": \"1\"\n-        }\n-      ]\n+      'is_error': 0,\n+      'version': 3,\n+      'count': 6,\n+      'values': [{\n+        'id': '17',\n+        'type_id': '1',\n+        'contact_id': '202',\n+        'status_id': '1',\n+        'from_date': '2016-02-01',\n+        'from_date_type': '1',\n+        'to_date': '2016-02-03',\n+        'to_date_type': '1'\n+      }, {\n+        'id': '18',\n+        'type_id': '1',\n+        'contact_id': '202',\n+        'status_id': '1',\n+        'from_date': '2016-08-17',\n+        'from_date_type': '1',\n+        'to_date': '2016-08-25',\n+        'to_date_type': '1'\n+      }, {\n+        'id': '19',\n+        'type_id': '1',\n+        'contact_id': '202',\n+        'status_id': '6',\n+        'from_date': '2016-01-30',\n+        'from_date_type': '1',\n+        'to_date': '2016-02-01',\n+        'to_date_type': '1'\n+      }, {\n+        'id': '20',\n+        'type_id': '1',\n+        'contact_id': '202',\n+        'status_id': '3',\n+        'from_date': '2016-11-23',\n+        'from_date_type': '1',\n+        'to_date': '2016-11-28',\n+        'to_date_type': '1'\n+      }, {\n+        'id': '21',\n+        'type_id': '3',\n+        'contact_id': '202',\n+        'status_id': '5',\n+        'from_date': '2016-06-03',\n+        'from_date_type': '1',\n+        'to_date': '2016-06-13',\n+        'to_date_type': '1'\n+      }, {\n+        'id': '22',\n+        'type_id': '2',\n+        'contact_id': '202',\n+        'status_id': '4',\n+        'from_date': '2016-01-01',\n+        'from_date_type': '1',\n+        'to_date': '2016-01-01',\n+        'to_date_type': '1'\n+      }]\n     },\n     singleDataSuccess: {\n-      \"is_error\": 0,\n-      \"version\": 3,\n-      \"count\": 1,\n-      \"values\": [\n-        {\n-          \"id\": \"17\",\n-          \"type_id\": \"1\",\n-          \"contact_id\": \"202\",\n-          \"status_id\": \"1\",\n-          \"from_date\": \"2016-02-01\",\n-          \"from_date_type\": \"1\",\n-          \"to_date\": \"2016-02-03\",\n-          \"to_date_type\": \"1\"\n-        }\n-      ]\n+      'is_error': 0,\n+      'version': 3,\n+      'count': 1,\n+      'values': [{\n+        'id': '17',\n+        'type_id': '1',\n+        'contact_id': '202',\n+        'status_id': '1',\n+        'from_date': '2016-02-01',\n+        'from_date_type': '1',\n+        'to_date': '2016-02-03',\n+        'to_date_type': '1'\n+      }]\n     },\n     singleDataError: {\n-      \"is_error\": 1,\n-      \"error_message\": jasmine.any(String)\n+      'is_error': 1,\n+      'error_message': jasmine.any(String)\n     },\n     balanceChangeByAbsenceTypeData: {\n+      'is_error': 0,\n+      'version': 3,\n+      'count': 3,\n+      'values': {\n+        '1': -21,\n+        '2': -1,\n+        '3': -11\n+      }\n+    },\n+    calculateBalanceChangeRequestData: {","path":"uk.co.compucorp.civicrm.hrleaveandabsences/js/angular/test/mocks/data/leave-request-data.js","position":178,"original_position":178,"commit_id":"d6dcd69b666bd49745850dfec99bd1e50cadff0b","original_commit_id":"d6dcd69b666bd49745850dfec99bd1e50cadff0b","user":{"login":"AkA84","id":6400898,"avatar_url":"https://avatars.githubusercontent.com/u/6400898?v=3","gravatar_id":"","url":"https://api.github.com/users/AkA84","html_url":"https://github.com/AkA84","followers_url":"https://api.github.com/users/AkA84/followers","following_url":"https://api.github.com/users/AkA84/following{/other_user}","gists_url":"https://api.github.com/users/AkA84/gists{/gist_id}","starred_url":"https://api.github.com/users/AkA84/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AkA84/subscriptions","organizations_url":"https://api.github.com/users/AkA84/orgs","repos_url":"https://api.github.com/users/AkA84/repos","events_url":"https://api.github.com/users/AkA84/events{/privacy}","received_events_url":"https://api.github.com/users/AkA84/received_events","type":"User","site_admin":false},"body":"I don't think I agree with this. Mocked data files are for mocked data coming *from* the server, not the other way around. If you need to mock the data to send to the server, just do that in the test","created_at":"2016-12-20T15:21:53Z","updated_at":"2016-12-20T15:21:53Z","html_url":"https://github.com/civicrm/civihr/pull/1298#discussion_r93258061","pull_request_url":"https://api.github.com/repos/civicrm/civihr/pulls/1298","_links":{"self":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/comments/93258061"},"html":{"href":"https://github.com/civicrm/civihr/pull/1298#discussion_r93258061"},"pull_request":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/1298"}}},"pull_request":{"url":"https://api.github.com/repos/civicrm/civihr/pulls/1298","id":98718313,"html_url":"https://github.com/civicrm/civihr/pull/1298","diff_url":"https://github.com/civicrm/civihr/pull/1298.diff","patch_url":"https://github.com/civicrm/civihr/pull/1298.patch","issue_url":"https://api.github.com/repos/civicrm/civihr/issues/1298","number":1298,"state":"open","locked":false,"title":"PCHR-1303: Augment leave request api model model instance","user":{"login":"dhavalsharma","id":89973,"avatar_url":"https://avatars.githubusercontent.com/u/89973?v=3","gravatar_id":"","url":"https://api.github.com/users/dhavalsharma","html_url":"https://github.com/dhavalsharma","followers_url":"https://api.github.com/users/dhavalsharma/followers","following_url":"https://api.github.com/users/dhavalsharma/following{/other_user}","gists_url":"https://api.github.com/users/dhavalsharma/gists{/gist_id}","starred_url":"https://api.github.com/users/dhavalsharma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhavalsharma/subscriptions","organizations_url":"https://api.github.com/users/dhavalsharma/orgs","repos_url":"https://api.github.com/users/dhavalsharma/repos","events_url":"https://api.github.com/users/dhavalsharma/events{/privacy}","received_events_url":"https://api.github.com/users/dhavalsharma/received_events","type":"User","site_admin":false},"body":"# LeaveRequest \r\nAugment LeaveRequest api end points as per ticket [PCHR-1303](https://compucorp.atlassian.net/browse/PCHR-1303).\r\n\r\n## API\r\nUser can `create`, `update` and `calculateBalanceChange` on leaverequests from `LeaveRequestAPI`. \r\nAlso, added `isValid` for doing additional validation before `create` call.\r\n\r\n## Model\r\nAdd `calculateBalanceChange` method.\r\n\r\n## Instance \r\nAdd `create`, `update` and `isValid` methods.\r\n\r\n## Source Code location\r\nIt is located under `civihr/uk.co.compucorp.civicrm.hrleaveandabsences/js/angular`.\r\n\r\nThe implementation is located under shared folder. \r\n\r\nThe test cases are in tests folder. \r\n\r\n## Sample LeaveRequest\r\nA sample response to `isValid` is presented below \r\n\r\n### `isValid` success response\r\n```json\r\n{\r\n  \"is_error\": 0,\r\n  \"count\": 0,\r\n  \"values\": []\r\n}\r\n```\r\n### `isValid` error  response\r\n```json\r\n{\r\n  \"is_error\": 0,\r\n  \"count\": 1,\r\n  \"values\": {\r\n    \"from_date\": [\r\n      \"overlaps_existing_leave_request\"\r\n    ]\r\n  }\r\n}\r\n```","created_at":"2016-12-20T10:02:47Z","updated_at":"2016-12-20T15:51:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9e66b6e257198f1f1feb83428863f64deef8cfa6","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/civicrm/civihr/pulls/1298/commits","review_comments_url":"https://api.github.com/repos/civicrm/civihr/pulls/1298/comments","review_comment_url":"https://api.github.com/repos/civicrm/civihr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/civicrm/civihr/issues/1298/comments","statuses_url":"https://api.github.com/repos/civicrm/civihr/statuses/d6dcd69b666bd49745850dfec99bd1e50cadff0b","head":{"label":"civicrm:PCHR-1303-Augment-LeaveRequest-API-Model-ModelInstance","ref":"PCHR-1303-Augment-LeaveRequest-API-Model-ModelInstance","sha":"d6dcd69b666bd49745850dfec99bd1e50cadff0b","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-10-25T11:36:09Z","pushed_at":"2016-12-20T15:24:03Z","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":37586,"stargazers_count":4,"watchers_count":4,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":27,"mirror_url":null,"open_issues_count":28,"forks":27,"open_issues":28,"watchers":4,"default_branch":"staging"}},"base":{"label":"civicrm:la-milestone-3","ref":"la-milestone-3","sha":"b718c73dbc89ae193eaebfc3cec3176cdc8310d9","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-10-25T11:36:09Z","pushed_at":"2016-12-20T15:24:03Z","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":37586,"stargazers_count":4,"watchers_count":4,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":27,"mirror_url":null,"open_issues_count":28,"forks":27,"open_issues":28,"watchers":4,"default_branch":"staging"}},"_links":{"self":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/1298"},"html":{"href":"https://github.com/civicrm/civihr/pull/1298"},"issue":{"href":"https://api.github.com/repos/civicrm/civihr/issues/1298"},"comments":{"href":"https://api.github.com/repos/civicrm/civihr/issues/1298/comments"},"review_comments":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/1298/comments"},"review_comment":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/civicrm/civihr/pulls/1298/commits"},"statuses":{"href":"https://api.github.com/repos/civicrm/civihr/statuses/d6dcd69b666bd49745850dfec99bd1e50cadff0b"}}}}
{"actor":{"display_login":"AkA84"}}