{"action":"created","comment":{"url":"https://api.github.com/repos/openmrs/openmrs-core/pulls/comments/82219541","pull_request_review_id":3142226,"id":82219541,"diff_hunk":"@@ -98,7 +97,235 @@\n \tpublic void runBeforeEachTest() throws Exception {\n \t\texecuteDataSet(ENC_INITIAL_DATA_XML);\n \t}\n-\t\n+\n+\t@Test\n+\t@Verifies(value = \"should save encounter correctly when a leaf child obs updated without recreating an entire obs hierarchy\", method = \"saveEncounter(Encounter)\")\n+\tpublic void saveEncounter_shouldNotCreateACopyOfParentObsButEditChildObs(){\n+\t\tConceptService cs = Context.getConceptService();\n+\t\tEncounterService es = Context.getEncounterService();\n+\t\tObsService os = Context.getObsService();\n+\n+\t\t//create an obs\n+\t\tObs o = createObs(cs.getConcept(3),\"original obs value text\");\n+\t\t//create a second obs\n+\t\tObs o2 = createObs(cs.getConcept(3),\"second obs value text\");\n+\t\t//create a parent obs\n+\t\tObs oParent =createObs(cs.getConcept(23), null); //in the concept set table as a set\n+\n+\t\t//add o and o2 to the parent obs\n+\t\toParent.addGroupMember(o2);\n+\t\toParent.addGroupMember(o);\n+\n+\t\tEncounter enc = buildEncounter();\n+\t\tenc.addObs(oParent);\n+\n+\t\tenc = es.saveEncounter(enc);","path":"api/src/test/java/org/openmrs/api/EncounterServiceTest.java","position":37,"original_position":37,"commit_id":"31b4c9f2b756293fa242a69ed5132a1c3e3ed824","original_commit_id":"31b4c9f2b756293fa242a69ed5132a1c3e3ed824","user":{"login":"wluyima","id":1395907,"avatar_url":"https://avatars.githubusercontent.com/u/1395907?v=3","gravatar_id":"","url":"https://api.github.com/users/wluyima","html_url":"https://github.com/wluyima","followers_url":"https://api.github.com/users/wluyima/followers","following_url":"https://api.github.com/users/wluyima/following{/other_user}","gists_url":"https://api.github.com/users/wluyima/gists{/gist_id}","starred_url":"https://api.github.com/users/wluyima/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wluyima/subscriptions","organizations_url":"https://api.github.com/users/wluyima/orgs","repos_url":"https://api.github.com/users/wluyima/repos","events_url":"https://api.github.com/users/wluyima/events{/privacy}","received_events_url":"https://api.github.com/users/wluyima/received_events","type":"User","site_admin":false},"body":"Don't you have to flush the session for the test to be concrete, couldn't you actually use an existing encounter already in the DB?","created_at":"2016-10-06T15:45:36Z","updated_at":"2016-10-06T15:45:36Z","html_url":"https://github.com/openmrs/openmrs-core/pull/1850#discussion_r82219541","pull_request_url":"https://api.github.com/repos/openmrs/openmrs-core/pulls/1850","_links":{"self":{"href":"https://api.github.com/repos/openmrs/openmrs-core/pulls/comments/82219541"},"html":{"href":"https://github.com/openmrs/openmrs-core/pull/1850#discussion_r82219541"},"pull_request":{"href":"https://api.github.com/repos/openmrs/openmrs-core/pulls/1850"}}},"pull_request":{"url":"https://api.github.com/repos/openmrs/openmrs-core/pulls/1850","id":87885932,"html_url":"https://github.com/openmrs/openmrs-core/pull/1850","diff_url":"https://github.com/openmrs/openmrs-core/pull/1850.diff","patch_url":"https://github.com/openmrs/openmrs-core/pull/1850.patch","issue_url":"https://api.github.com/repos/openmrs/openmrs-core/issues/1850","number":1850,"state":"open","locked":false,"title":"Fix for editing a child obs makes the parent obs dirty and creates a new instance","user":{"login":"bharatak","id":9331624,"avatar_url":"https://avatars.githubusercontent.com/u/9331624?v=3","gravatar_id":"","url":"https://api.github.com/users/bharatak","html_url":"https://github.com/bharatak","followers_url":"https://api.github.com/users/bharatak/followers","following_url":"https://api.github.com/users/bharatak/following{/other_user}","gists_url":"https://api.github.com/users/bharatak/gists{/gist_id}","starred_url":"https://api.github.com/users/bharatak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bharatak/subscriptions","organizations_url":"https://api.github.com/users/bharatak/orgs","repos_url":"https://api.github.com/users/bharatak/repos","events_url":"https://api.github.com/users/bharatak/events{/privacy}","received_events_url":"https://api.github.com/users/bharatak/received_events","type":"User","site_admin":false},"body":"TRUNK-4944\r\n\r\n## Description\r\nThis PR fixes the cloning of parent obs when a child (leaf) obs is edited.   The following are the things that are done\r\n\r\n- Removed setting the dirty flag when obs.setGroupMembers(), obs.addGroupMember() and obs.removeGroupMember() is called\r\n- EncounterService.saveEncounter() will use encounter.getObsAtTopLevel() so that we just pick up the top level obs.  Saving a top level obs using obsService.saveObs() will take care of individually saving the leaf obs.\r\n- Added integration tests for various obs hirearchies and saving of obs at different levels - leaf, middle level, top level and peer at top level\r\n\r\n## Related Issue\r\n<!--- This project only accepts pull requests related to open issues -->\r\n<!--- If suggesting a new feature or change, please discuss it in an issue\r\nfirst -->\r\n<!--- If fixing a bug, there should be an issue describing it with steps to\r\nreproduce -->\r\n<!--- Please link to the issue here: -->\r\nsee https://issues.openmrs.org/browse/TRUNK-4944\r\n\r\n## Checklist:\r\n<!--- Go over all the following points, and put an `x` in all the boxes that\r\napply. -->\r\n<!--- If you're unsure about any of these, don't hesitate to ask. We're here to\r\nhelp! -->\r\n- [x] My pull request only contains one single commit.\r\n- [x] My pull request is based on the latest master branch\r\n  `git pull --rebase upstream master`.\r\n- [x] I ran `mvn clean package` right before creating this pull request and\r\n  added all formatting changes to my commit.\r\n- [x] My code follows the code style of this project.\r\n- [x] I have read the **CONTRIBUTING** document.\r\n- [x] I have added tests to cover my changes.\r\n- [x] All new and existing tests passed.\r\n\r\n\r\n","created_at":"2016-10-04T12:40:37Z","updated_at":"2016-10-06T15:45:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"271f09e30c528d26cb630a9e41c27486ac98cb00","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/openmrs/openmrs-core/pulls/1850/commits","review_comments_url":"https://api.github.com/repos/openmrs/openmrs-core/pulls/1850/comments","review_comment_url":"https://api.github.com/repos/openmrs/openmrs-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openmrs/openmrs-core/issues/1850/comments","statuses_url":"https://api.github.com/repos/openmrs/openmrs-core/statuses/31b4c9f2b756293fa242a69ed5132a1c3e3ed824","head":{"label":"bharatak:4944","ref":"4944","sha":"31b4c9f2b756293fa242a69ed5132a1c3e3ed824","user":{"login":"bharatak","id":9331624,"avatar_url":"https://avatars.githubusercontent.com/u/9331624?v=3","gravatar_id":"","url":"https://api.github.com/users/bharatak","html_url":"https://github.com/bharatak","followers_url":"https://api.github.com/users/bharatak/followers","following_url":"https://api.github.com/users/bharatak/following{/other_user}","gists_url":"https://api.github.com/users/bharatak/gists{/gist_id}","starred_url":"https://api.github.com/users/bharatak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bharatak/subscriptions","organizations_url":"https://api.github.com/users/bharatak/orgs","repos_url":"https://api.github.com/users/bharatak/repos","events_url":"https://api.github.com/users/bharatak/events{/privacy}","received_events_url":"https://api.github.com/users/bharatak/received_events","type":"User","site_admin":false},"repo":{"id":40346117,"name":"openmrs-core","full_name":"bharatak/openmrs-core","owner":{"login":"bharatak","id":9331624,"avatar_url":"https://avatars.githubusercontent.com/u/9331624?v=3","gravatar_id":"","url":"https://api.github.com/users/bharatak","html_url":"https://github.com/bharatak","followers_url":"https://api.github.com/users/bharatak/followers","following_url":"https://api.github.com/users/bharatak/following{/other_user}","gists_url":"https://api.github.com/users/bharatak/gists{/gist_id}","starred_url":"https://api.github.com/users/bharatak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bharatak/subscriptions","organizations_url":"https://api.github.com/users/bharatak/orgs","repos_url":"https://api.github.com/users/bharatak/repos","events_url":"https://api.github.com/users/bharatak/events{/privacy}","received_events_url":"https://api.github.com/users/bharatak/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bharatak/openmrs-core","description":"OpenMRS API and web application code","fork":true,"url":"https://api.github.com/repos/bharatak/openmrs-core","forks_url":"https://api.github.com/repos/bharatak/openmrs-core/forks","keys_url":"https://api.github.com/repos/bharatak/openmrs-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bharatak/openmrs-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bharatak/openmrs-core/teams","hooks_url":"https://api.github.com/repos/bharatak/openmrs-core/hooks","issue_events_url":"https://api.github.com/repos/bharatak/openmrs-core/issues/events{/number}","events_url":"https://api.github.com/repos/bharatak/openmrs-core/events","assignees_url":"https://api.github.com/repos/bharatak/openmrs-core/assignees{/user}","branches_url":"https://api.github.com/repos/bharatak/openmrs-core/branches{/branch}","tags_url":"https://api.github.com/repos/bharatak/openmrs-core/tags","blobs_url":"https://api.github.com/repos/bharatak/openmrs-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bharatak/openmrs-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bharatak/openmrs-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/bharatak/openmrs-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bharatak/openmrs-core/statuses/{sha}","languages_url":"https://api.github.com/repos/bharatak/openmrs-core/languages","stargazers_url":"https://api.github.com/repos/bharatak/openmrs-core/stargazers","contributors_url":"https://api.github.com/repos/bharatak/openmrs-core/contributors","subscribers_url":"https://api.github.com/repos/bharatak/openmrs-core/subscribers","subscription_url":"https://api.github.com/repos/bharatak/openmrs-core/subscription","commits_url":"https://api.github.com/repos/bharatak/openmrs-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/bharatak/openmrs-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/bharatak/openmrs-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/bharatak/openmrs-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/bharatak/openmrs-core/contents/{+path}","compare_url":"https://api.github.com/repos/bharatak/openmrs-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bharatak/openmrs-core/merges","archive_url":"https://api.github.com/repos/bharatak/openmrs-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bharatak/openmrs-core/downloads","issues_url":"https://api.github.com/repos/bharatak/openmrs-core/issues{/number}","pulls_url":"https://api.github.com/repos/bharatak/openmrs-core/pulls{/number}","milestones_url":"https://api.github.com/repos/bharatak/openmrs-core/milestones{/number}","notifications_url":"https://api.github.com/repos/bharatak/openmrs-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bharatak/openmrs-core/labels{/name}","releases_url":"https://api.github.com/repos/bharatak/openmrs-core/releases{/id}","deployments_url":"https://api.github.com/repos/bharatak/openmrs-core/deployments","created_at":"2015-08-07T07:00:04Z","updated_at":"2016-09-18T07:31:50Z","pushed_at":"2016-10-04T12:30:38Z","git_url":"git://github.com/bharatak/openmrs-core.git","ssh_url":"git@github.com:bharatak/openmrs-core.git","clone_url":"https://github.com/bharatak/openmrs-core.git","svn_url":"https://github.com/bharatak/openmrs-core","homepage":"http://openmrs.org","size":219346,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"openmrs:2.0.x","ref":"2.0.x","sha":"aa0d1b7d12dd681ae3134fab545f4e9b161be87b","user":{"login":"openmrs","id":860776,"avatar_url":"https://avatars.githubusercontent.com/u/860776?v=3","gravatar_id":"","url":"https://api.github.com/users/openmrs","html_url":"https://github.com/openmrs","followers_url":"https://api.github.com/users/openmrs/followers","following_url":"https://api.github.com/users/openmrs/following{/other_user}","gists_url":"https://api.github.com/users/openmrs/gists{/gist_id}","starred_url":"https://api.github.com/users/openmrs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openmrs/subscriptions","organizations_url":"https://api.github.com/users/openmrs/orgs","repos_url":"https://api.github.com/users/openmrs/repos","events_url":"https://api.github.com/users/openmrs/events{/privacy}","received_events_url":"https://api.github.com/users/openmrs/received_events","type":"Organization","site_admin":false},"repo":{"id":5187976,"name":"openmrs-core","full_name":"openmrs/openmrs-core","owner":{"login":"openmrs","id":860776,"avatar_url":"https://avatars.githubusercontent.com/u/860776?v=3","gravatar_id":"","url":"https://api.github.com/users/openmrs","html_url":"https://github.com/openmrs","followers_url":"https://api.github.com/users/openmrs/followers","following_url":"https://api.github.com/users/openmrs/following{/other_user}","gists_url":"https://api.github.com/users/openmrs/gists{/gist_id}","starred_url":"https://api.github.com/users/openmrs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openmrs/subscriptions","organizations_url":"https://api.github.com/users/openmrs/orgs","repos_url":"https://api.github.com/users/openmrs/repos","events_url":"https://api.github.com/users/openmrs/events{/privacy}","received_events_url":"https://api.github.com/users/openmrs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openmrs/openmrs-core","description":"OpenMRS API and web application code","fork":false,"url":"https://api.github.com/repos/openmrs/openmrs-core","forks_url":"https://api.github.com/repos/openmrs/openmrs-core/forks","keys_url":"https://api.github.com/repos/openmrs/openmrs-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openmrs/openmrs-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openmrs/openmrs-core/teams","hooks_url":"https://api.github.com/repos/openmrs/openmrs-core/hooks","issue_events_url":"https://api.github.com/repos/openmrs/openmrs-core/issues/events{/number}","events_url":"https://api.github.com/repos/openmrs/openmrs-core/events","assignees_url":"https://api.github.com/repos/openmrs/openmrs-core/assignees{/user}","branches_url":"https://api.github.com/repos/openmrs/openmrs-core/branches{/branch}","tags_url":"https://api.github.com/repos/openmrs/openmrs-core/tags","blobs_url":"https://api.github.com/repos/openmrs/openmrs-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openmrs/openmrs-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openmrs/openmrs-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/openmrs/openmrs-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openmrs/openmrs-core/statuses/{sha}","languages_url":"https://api.github.com/repos/openmrs/openmrs-core/languages","stargazers_url":"https://api.github.com/repos/openmrs/openmrs-core/stargazers","contributors_url":"https://api.github.com/repos/openmrs/openmrs-core/contributors","subscribers_url":"https://api.github.com/repos/openmrs/openmrs-core/subscribers","subscription_url":"https://api.github.com/repos/openmrs/openmrs-core/subscription","commits_url":"https://api.github.com/repos/openmrs/openmrs-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/openmrs/openmrs-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/openmrs/openmrs-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/openmrs/openmrs-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/openmrs/openmrs-core/contents/{+path}","compare_url":"https://api.github.com/repos/openmrs/openmrs-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openmrs/openmrs-core/merges","archive_url":"https://api.github.com/repos/openmrs/openmrs-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openmrs/openmrs-core/downloads","issues_url":"https://api.github.com/repos/openmrs/openmrs-core/issues{/number}","pulls_url":"https://api.github.com/repos/openmrs/openmrs-core/pulls{/number}","milestones_url":"https://api.github.com/repos/openmrs/openmrs-core/milestones{/number}","notifications_url":"https://api.github.com/repos/openmrs/openmrs-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openmrs/openmrs-core/labels{/name}","releases_url":"https://api.github.com/repos/openmrs/openmrs-core/releases{/id}","deployments_url":"https://api.github.com/repos/openmrs/openmrs-core/deployments","created_at":"2012-07-26T04:54:29Z","updated_at":"2016-10-03T13:36:03Z","pushed_at":"2016-10-06T04:19:43Z","git_url":"git://github.com/openmrs/openmrs-core.git","ssh_url":"git@github.com:openmrs/openmrs-core.git","clone_url":"https://github.com/openmrs/openmrs-core.git","svn_url":"https://github.com/openmrs/openmrs-core","homepage":"http://openmrs.org","size":239685,"stargazers_count":368,"watchers_count":368,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1532,"mirror_url":null,"open_issues_count":5,"forks":1532,"open_issues":5,"watchers":368,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openmrs/openmrs-core/pulls/1850"},"html":{"href":"https://github.com/openmrs/openmrs-core/pull/1850"},"issue":{"href":"https://api.github.com/repos/openmrs/openmrs-core/issues/1850"},"comments":{"href":"https://api.github.com/repos/openmrs/openmrs-core/issues/1850/comments"},"review_comments":{"href":"https://api.github.com/repos/openmrs/openmrs-core/pulls/1850/comments"},"review_comment":{"href":"https://api.github.com/repos/openmrs/openmrs-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openmrs/openmrs-core/pulls/1850/commits"},"statuses":{"href":"https://api.github.com/repos/openmrs/openmrs-core/statuses/31b4c9f2b756293fa242a69ed5132a1c3e3ed824"}}}}
{"actor":{"display_login":"wluyima"}}