GitHub PullRequestReviewCommentEvent at 2014-12-16 14:08:32
Repository: commcare-hq
Actor: millerdev
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/comments/21899212","id":21899212,"diff_hunk":"@@ -713,6 +714,56 @@ def get_languages(self):\n             langs.append(translation.attrib['lang'])\n         return langs\n \n+    @raise_if_none(\"Can't find <label>\")\n+    def get_question_label(self, question_id):\n+        \"\"\"\n+        Return the label child of the element in the xform body with\n+        ref=quesiton_id\n+        :param question_id: The path to the question, ex: \"foo/age\". Note that\n+        \"/data/\" should not be included at the begining of the path.\n+        :return:\n+        \"\"\"\n+\n+        # TODO: Is there a better way to identify multiselects?\n+        regex = '(.*)-item([0-9]*)$'","path":"corehq/apps/app_manager/xform.py","position":22,"original_position":22,"commit_id":"1e8f3d127446f2255eb4bb617d3b7c822063310a","original_commit_id":"1e8f3d127446f2255eb4bb617d3b7c822063310a","user":{"login":"millerdev","id":464726,"avatar_url":"https://avatars.githubusercontent.com/u/464726?v=3","gravatar_id":"","url":"https://api.github.com/users/millerdev","html_url":"https://github.com/millerdev","followers_url":"https://api.github.com/users/millerdev/followers","following_url":"https://api.github.com/users/millerdev/following{/other_user}","gists_url":"https://api.github.com/users/millerdev/gists{/gist_id}","starred_url":"https://api.github.com/users/millerdev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/millerdev/subscriptions","organizations_url":"https://api.github.com/users/millerdev/orgs","repos_url":"https://api.github.com/users/millerdev/repos","events_url":"https://api.github.com/users/millerdev/events{/privacy}","received_events_url":"https://api.github.com/users/millerdev/received_events","type":"User","site_admin":false},"body":"I don't think all multiselect item labels follow this pattern. I may be confused about what you're matching...\r\n\r\nShould probably use `re.compile` here too if this is the best way to solve the issue.","created_at":"2014-12-16T14:08:32Z","updated_at":"2014-12-16T14:08:32Z","html_url":"https://github.com/dimagi/commcare-hq/pull/5098#discussion_r21899212","pull_request_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/5098","_links":{"self":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/comments/21899212"},"html":{"href":"https://github.com/dimagi/commcare-hq/pull/5098#discussion_r21899212"},"pull_request":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/5098"}}},"pull_request":{"url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/5098","id":26133647,"html_url":"https://github.com/dimagi/commcare-hq/pull/5098","diff_url":"https://github.com/dimagi/commcare-hq/pull/5098.diff","patch_url":"https://github.com/dimagi/commcare-hq/pull/5098.patch","issue_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/5098","number":5098,"state":"open","locked":false,"title":"Fix bug in bulk app translation regarding unexpected translation/text id attributes","user":{"login":"NoahCarnahan","id":2117127,"avatar_url":"https://avatars.githubusercontent.com/u/2117127?v=3","gravatar_id":"","url":"https://api.github.com/users/NoahCarnahan","html_url":"https://github.com/NoahCarnahan","followers_url":"https://api.github.com/users/NoahCarnahan/followers","following_url":"https://api.github.com/users/NoahCarnahan/following{/other_user}","gists_url":"https://api.github.com/users/NoahCarnahan/gists{/gist_id}","starred_url":"https://api.github.com/users/NoahCarnahan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NoahCarnahan/subscriptions","organizations_url":"https://api.github.com/users/NoahCarnahan/orgs","repos_url":"https://api.github.com/users/NoahCarnahan/repos","events_url":"https://api.github.com/users/NoahCarnahan/events{/privacy}","received_events_url":"https://api.github.com/users/NoahCarnahan/received_events","type":"User","site_admin":false},"body":"[Ticket](http://manage.dimagi.com/default.asp?150545)\r\n\r\nThis PR fixes a bug in bulk app translations. The code had been operating under the false assumption that a question with an id of `path/to/question` would have its translation located in a node at `itext/translation/text[@id='path/to/question-label']`. However, this is not always the case.\r\n\r\nCreate a question within a question group in vellum, save, then alter the id of the question group and save again. The itext ref path will mirror the original path to the question, not it's current path. That is, suppose you have a form with the following structure:\r\n```\r\n<h:body>\r\n   <group ref=\"/data/question1\">\r\n      <label ref=\"jr:itext('question1-label')\" />\r\n      <input ref=\"/data/question1/foo\">\r\n         <label ref=\"jr:itext('question1/foo-label')\" />\r\n      </input>\r\n   </group>\r\n</h:body>\r\n```\r\nIf you change the group id in vellum from `question1` to `mygroup`, the form will look like this after saving:\r\n```\r\n<h:body>\r\n   <group ref=\"/data/mygroup\">\r\n      <label ref=\"jr:itext('mygroup-label')\" />\r\n      <input ref=\"/data/mygroup/foo\">\r\n         <label ref=\"jr:itext('question1/foo-label')\" /> <!-- note that this node hasn't changed -->\r\n      </input>\r\n   </group>\r\n</h:body>\r\n```\r\n\r\nThis PR removes this assumption, and instead inspects the xform body itself to determine the itext id corresponding to each question.\r\n","created_at":"2014-12-16T09:49:26Z","updated_at":"2014-12-16T14:08:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1e26c0d996ed5511ec96da8330674488aa6c40dc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/5098/commits","review_comments_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/5098/comments","review_comment_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/comments/{number}","comments_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/5098/comments","statuses_url":"https://api.github.com/repos/dimagi/commcare-hq/statuses/1e8f3d127446f2255eb4bb617d3b7c822063310a","head":{"label":"dimagi:translate-fix","ref":"translate-fix","sha":"1e8f3d127446f2255eb4bb617d3b7c822063310a","user":{"login":"dimagi","id":94514,"avatar_url":"https://avatars.githubusercontent.com/u/94514?v=3","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"repo":{"id":247278,"name":"commcare-hq","full_name":"dimagi/commcare-hq","owner":{"login":"dimagi","id":94514,"avatar_url":"https://avatars.githubusercontent.com/u/94514?v=3","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dimagi/commcare-hq","description":"A server-side tool to help manage community health workers, written in Django","fork":false,"url":"https://api.github.com/repos/dimagi/commcare-hq","forks_url":"https://api.github.com/repos/dimagi/commcare-hq/forks","keys_url":"https://api.github.com/repos/dimagi/commcare-hq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dimagi/commcare-hq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dimagi/commcare-hq/teams","hooks_url":"https://api.github.com/repos/dimagi/commcare-hq/hooks","issue_events_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/events{/number}","events_url":"https://api.github.com/repos/dimagi/commcare-hq/events","assignees_url":"https://api.github.com/repos/dimagi/commcare-hq/assignees{/user}","branches_url":"https://api.github.com/repos/dimagi/commcare-hq/branches{/branch}","tags_url":"https://api.github.com/repos/dimagi/commcare-hq/tags","blobs_url":"https://api.github.com/repos/dimagi/commcare-hq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dimagi/commcare-hq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dimagi/commcare-hq/git/refs{/sha}","trees_url":"https://api.github.com/repos/dimagi/commcare-hq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dimagi/commcare-hq/statuses/{sha}","languages_url":"https://api.github.com/repos/dimagi/commcare-hq/languages","stargazers_url":"https://api.github.com/repos/dimagi/commcare-hq/stargazers","contributors_url":"https://api.github.com/repos/dimagi/commcare-hq/contributors","subscribers_url":"https://api.github.com/repos/dimagi/commcare-hq/subscribers","subscription_url":"https://api.github.com/repos/dimagi/commcare-hq/subscription","commits_url":"https://api.github.com/repos/dimagi/commcare-hq/commits{/sha}","git_commits_url":"https://api.github.com/repos/dimagi/commcare-hq/git/commits{/sha}","comments_url":"https://api.github.com/repos/dimagi/commcare-hq/comments{/number}","issue_comment_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/comments/{number}","contents_url":"https://api.github.com/repos/dimagi/commcare-hq/contents/{+path}","compare_url":"https://api.github.com/repos/dimagi/commcare-hq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dimagi/commcare-hq/merges","archive_url":"https://api.github.com/repos/dimagi/commcare-hq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dimagi/commcare-hq/downloads","issues_url":"https://api.github.com/repos/dimagi/commcare-hq/issues{/number}","pulls_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls{/number}","milestones_url":"https://api.github.com/repos/dimagi/commcare-hq/milestones{/number}","notifications_url":"https://api.github.com/repos/dimagi/commcare-hq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dimagi/commcare-hq/labels{/name}","releases_url":"https://api.github.com/repos/dimagi/commcare-hq/releases{/id}","created_at":"2009-07-09T17:00:07Z","updated_at":"2014-12-16T13:44:13Z","pushed_at":"2014-12-16T13:56:54Z","git_url":"git://github.com/dimagi/commcare-hq.git","ssh_url":"git@github.com:dimagi/commcare-hq.git","clone_url":"https://github.com/dimagi/commcare-hq.git","svn_url":"https://github.com/dimagi/commcare-hq","homepage":"http://www.commcarehq.org","size":182397,"stargazers_count":40,"watchers_count":40,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":56,"mirror_url":null,"open_issues_count":36,"forks":56,"open_issues":36,"watchers":40,"default_branch":"master"}},"base":{"label":"dimagi:master","ref":"master","sha":"43c6608e307c30f24c92208c9c40fe660640e9a1","user":{"login":"dimagi","id":94514,"avatar_url":"https://avatars.githubusercontent.com/u/94514?v=3","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"repo":{"id":247278,"name":"commcare-hq","full_name":"dimagi/commcare-hq","owner":{"login":"dimagi","id":94514,"avatar_url":"https://avatars.githubusercontent.com/u/94514?v=3","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dimagi/commcare-hq","description":"A server-side tool to help manage community health workers, written in Django","fork":false,"url":"https://api.github.com/repos/dimagi/commcare-hq","forks_url":"https://api.github.com/repos/dimagi/commcare-hq/forks","keys_url":"https://api.github.com/repos/dimagi/commcare-hq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dimagi/commcare-hq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dimagi/commcare-hq/teams","hooks_url":"https://api.github.com/repos/dimagi/commcare-hq/hooks","issue_events_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/events{/number}","events_url":"https://api.github.com/repos/dimagi/commcare-hq/events","assignees_url":"https://api.github.com/repos/dimagi/commcare-hq/assignees{/user}","branches_url":"https://api.github.com/repos/dimagi/commcare-hq/branches{/branch}","tags_url":"https://api.github.com/repos/dimagi/commcare-hq/tags","blobs_url":"https://api.github.com/repos/dimagi/commcare-hq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dimagi/commcare-hq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dimagi/commcare-hq/git/refs{/sha}","trees_url":"https://api.github.com/repos/dimagi/commcare-hq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dimagi/commcare-hq/statuses/{sha}","languages_url":"https://api.github.com/repos/dimagi/commcare-hq/languages","stargazers_url":"https://api.github.com/repos/dimagi/commcare-hq/stargazers","contributors_url":"https://api.github.com/repos/dimagi/commcare-hq/contributors","subscribers_url":"https://api.github.com/repos/dimagi/commcare-hq/subscribers","subscription_url":"https://api.github.com/repos/dimagi/commcare-hq/subscription","commits_url":"https://api.github.com/repos/dimagi/commcare-hq/commits{/sha}","git_commits_url":"https://api.github.com/repos/dimagi/commcare-hq/git/commits{/sha}","comments_url":"https://api.github.com/repos/dimagi/commcare-hq/comments{/number}","issue_comment_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/comments/{number}","contents_url":"https://api.github.com/repos/dimagi/commcare-hq/contents/{+path}","compare_url":"https://api.github.com/repos/dimagi/commcare-hq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dimagi/commcare-hq/merges","archive_url":"https://api.github.com/repos/dimagi/commcare-hq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dimagi/commcare-hq/downloads","issues_url":"https://api.github.com/repos/dimagi/commcare-hq/issues{/number}","pulls_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls{/number}","milestones_url":"https://api.github.com/repos/dimagi/commcare-hq/milestones{/number}","notifications_url":"https://api.github.com/repos/dimagi/commcare-hq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dimagi/commcare-hq/labels{/name}","releases_url":"https://api.github.com/repos/dimagi/commcare-hq/releases{/id}","created_at":"2009-07-09T17:00:07Z","updated_at":"2014-12-16T13:44:13Z","pushed_at":"2014-12-16T13:56:54Z","git_url":"git://github.com/dimagi/commcare-hq.git","ssh_url":"git@github.com:dimagi/commcare-hq.git","clone_url":"https://github.com/dimagi/commcare-hq.git","svn_url":"https://github.com/dimagi/commcare-hq","homepage":"http://www.commcarehq.org","size":182397,"stargazers_count":40,"watchers_count":40,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":56,"mirror_url":null,"open_issues_count":36,"forks":56,"open_issues":36,"watchers":40,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/5098"},"html":{"href":"https://github.com/dimagi/commcare-hq/pull/5098"},"issue":{"href":"https://api.github.com/repos/dimagi/commcare-hq/issues/5098"},"comments":{"href":"https://api.github.com/repos/dimagi/commcare-hq/issues/5098/comments"},"review_comments":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/5098/comments"},"review_comment":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/5098/commits"},"statuses":{"href":"https://api.github.com/repos/dimagi/commcare-hq/statuses/1e8f3d127446f2255eb4bb617d3b7c822063310a"}}}}