GitHub PullRequestReviewCommentEvent at 2014-08-11 08:50:55
Repository: edx-platform
Actor: jmclaus
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/comments/16042896","id":16042896,"diff_hunk":"@@ -1109,20 +1109,58 @@ def get_user_partition(self):\n     @staticmethod\n     def get_usage_info(course, store):\n         \"\"\"\n-        Get all units names and their urls that have experiments and associated\n-        with configurations.\n+        Get usage information for all Group Configurations.\n+        \"\"\"\n+        split_tests = store.get_items(course.id, category='split_test')\n+        return GroupConfiguration._get_usage_info(store, course, split_tests)\n+\n+    @staticmethod\n+    def add_usage_info(course, store):\n+        \"\"\"\n+        Add usage information to group configurations jsons in course.\n+\n+        Returns json of group configurations updated with usage information.\n+        \"\"\"\n+        usage_info = GroupConfiguration.get_usage_info(course, store)\n+        configurations = []\n+        for partition in course.user_partitions:\n+            configuration = partition.to_json()\n+            configuration['usage'] = usage_info.get(partition.id, [])\n+            configurations.append(configuration)\n+        return configurations\n+\n+    @staticmethod\n+    # TODO: Make sure message_text is the same String as the one used on unit page\n+    def get_validation_message(split_test):\n+        \"\"\"\n+        Get validation message for experiment that appears on unit page.\n+        \"\"\"\n+        message_text =  'This content experiment has issues that affect content visibility.'\n+        message_type = 'warning'\n+        for message in split_test.validation_messages():\n+            if message.message_type == 'error':\n+                message_type = 'error'\n+        if split_test.validation_messages():\n+            return {'message': message_text, 'type': message_type}\n+        else:\n+            return None\n+\n+    @staticmethod\n+    def _get_usage_info(store, course, split_tests):\n+        \"\"\"\n+        Returns all units names, their urls and validation messages.\n \n         Returns:\n         {'user_partition_id':\n             [\n-                {'label': 'Unit Name / Experiment Name', 'url': 'url_to_unit_1'},\n-                {'label': 'Another Unit Name / Another Experiment Name', 'url': 'url_to_unit_1'}\n+                {'label': 'Unit Name / Experiment Name', 'url': 'url_to_unit_1', 'validation': [u'Validation message.']},\n+                {'label': 'Another Unit Name / Another Experiment Name', 'url': 'url_to_unit_1','validation': []}","path":"cms/djangoapps/contentstore/views/course.py","position":62,"original_position":62,"commit_id":"2a6fe266000ec39d59f89eb2d55c83ba6d20c8a8","original_commit_id":"2a6fe266000ec39d59f89eb2d55c83ba6d20c8a8","user":{"login":"jmclaus","id":1427382,"avatar_url":"https://avatars.githubusercontent.com/u/1427382?v=2","gravatar_id":"3d5a5b850789d1ed61841d46f54635bb","url":"https://api.github.com/users/jmclaus","html_url":"https://github.com/jmclaus","followers_url":"https://api.github.com/users/jmclaus/followers","following_url":"https://api.github.com/users/jmclaus/following{/other_user}","gists_url":"https://api.github.com/users/jmclaus/gists{/gist_id}","starred_url":"https://api.github.com/users/jmclaus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmclaus/subscriptions","organizations_url":"https://api.github.com/users/jmclaus/orgs","repos_url":"https://api.github.com/users/jmclaus/repos","events_url":"https://api.github.com/users/jmclaus/events{/privacy}","received_events_url":"https://api.github.com/users/jmclaus/received_events","type":"User","site_admin":false},"body":"@polesye \r\n>Fix docstring. Format for validation messages was changed.\r\n\r\nDone.","created_at":"2014-08-11T08:50:55Z","updated_at":"2014-08-11T08:50:55Z","html_url":"https://github.com/edx/edx-platform/pull/4735#discussion_r16042896","pull_request_url":"https://api.github.com/repos/edx/edx-platform/pulls/4735","_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments/16042896"},"html":{"href":"https://github.com/edx/edx-platform/pull/4735#discussion_r16042896"},"pull_request":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/4735"}}},"pull_request":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/4735","id":19467856,"html_url":"https://github.com/edx/edx-platform/pull/4735","diff_url":"https://github.com/edx/edx-platform/pull/4735.diff","patch_url":"https://github.com/edx/edx-platform/pull/4735.patch","issue_url":"https://api.github.com/repos/edx/edx-platform/issues/4735","number":4735,"state":"open","title":"BLD-1125: Validate content experiments after managing a group.","user":{"login":"olmar","id":3625483,"avatar_url":"https://avatars.githubusercontent.com/u/3625483?v=2","gravatar_id":"543e5cc11f8b81fb803ccbfb7a5d39b4","url":"https://api.github.com/users/olmar","html_url":"https://github.com/olmar","followers_url":"https://api.github.com/users/olmar/followers","following_url":"https://api.github.com/users/olmar/following{/other_user}","gists_url":"https://api.github.com/users/olmar/gists{/gist_id}","starred_url":"https://api.github.com/users/olmar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olmar/subscriptions","organizations_url":"https://api.github.com/users/olmar/orgs","repos_url":"https://api.github.com/users/olmar/repos","events_url":"https://api.github.com/users/olmar/events{/privacy}","received_events_url":"https://api.github.com/users/olmar/received_events","type":"User","site_admin":false},"body":"As a course author, I want to validate my content experiments after managing a group.\r\n\r\n**Ticket: [BLD-1125](https://openedx.atlassian.net/browse/BLD-1125)**\r\n\r\n**Acceptance criteria:**\r\n* On save of a group configuration, Studio should validate all of the content experiments in the course that use it. If there are any messages then they should be displayed below the unit name/link.\r\n* In addition, whenever a group configuration is shown, its content experiments should be validated, and any messages shown in the same way.\r\n\r\n**Sandbox:** http://studio.olmar.m.sandbox.edx.org/\r\n\r\n**Note**:  Bok-choy tests left to be done.\r\n\r\n@explorerleslie @frrrances ","created_at":"2014-08-07T13:52:47Z","updated_at":"2014-08-11T08:50:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c1de3fecab87dbfa062e79cbc3a56433e49feef4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/edx/edx-platform/pulls/4735/commits","review_comments_url":"https://api.github.com/repos/edx/edx-platform/pulls/4735/comments","review_comment_url":"https://api.github.com/repos/edx/edx-platform/pulls/comments/{number}","comments_url":"https://api.github.com/repos/edx/edx-platform/issues/4735/comments","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/2a6fe266000ec39d59f89eb2d55c83ba6d20c8a8","head":{"label":"edx:oleg/validate-content-experiments","ref":"oleg/validate-content-experiments","sha":"2a6fe266000ec39d59f89eb2d55c83ba6d20c8a8","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=2","gravatar_id":"e1f6c6dc8772c47c0261cd5df2ed2814","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":10391073,"name":"edx-platform","full_name":"edx/edx-platform","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=2","gravatar_id":"e1f6c6dc8772c47c0261cd5df2ed2814","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/edx-platform","description":"Open edX, the edX platform that powers http://edx.org","fork":false,"url":"https://api.github.com/repos/edx/edx-platform","forks_url":"https://api.github.com/repos/edx/edx-platform/forks","keys_url":"https://api.github.com/repos/edx/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-platform/teams","hooks_url":"https://api.github.com/repos/edx/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-platform/events","assignees_url":"https://api.github.com/repos/edx/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-platform/tags","blobs_url":"https://api.github.com/repos/edx/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-platform/languages","stargazers_url":"https://api.github.com/repos/edx/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-platform/subscription","commits_url":"https://api.github.com/repos/edx/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-platform/issues/comments/{number}","contents_url":"https://api.github.com/repos/edx/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-platform/merges","archive_url":"https://api.github.com/repos/edx/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-platform/downloads","issues_url":"https://api.github.com/repos/edx/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-platform/releases{/id}","created_at":"2013-05-30T20:20:38Z","updated_at":"2014-08-09T16:26:52Z","pushed_at":"2014-08-11T08:15:40Z","git_url":"git://github.com/edx/edx-platform.git","ssh_url":"git@github.com:edx/edx-platform.git","clone_url":"https://github.com/edx/edx-platform.git","svn_url":"https://github.com/edx/edx-platform","homepage":"http://openedx.org/","size":1542175,"stargazers_count":1355,"watchers_count":1355,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":757,"mirror_url":null,"open_issues_count":110,"forks":757,"open_issues":110,"watchers":1355,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"26b08a0205c956bbb964e2b17f037b186f2e4697","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=2","gravatar_id":"e1f6c6dc8772c47c0261cd5df2ed2814","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":10391073,"name":"edx-platform","full_name":"edx/edx-platform","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=2","gravatar_id":"e1f6c6dc8772c47c0261cd5df2ed2814","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/edx-platform","description":"Open edX, the edX platform that powers http://edx.org","fork":false,"url":"https://api.github.com/repos/edx/edx-platform","forks_url":"https://api.github.com/repos/edx/edx-platform/forks","keys_url":"https://api.github.com/repos/edx/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-platform/teams","hooks_url":"https://api.github.com/repos/edx/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-platform/events","assignees_url":"https://api.github.com/repos/edx/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-platform/tags","blobs_url":"https://api.github.com/repos/edx/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-platform/languages","stargazers_url":"https://api.github.com/repos/edx/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-platform/subscription","commits_url":"https://api.github.com/repos/edx/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-platform/issues/comments/{number}","contents_url":"https://api.github.com/repos/edx/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-platform/merges","archive_url":"https://api.github.com/repos/edx/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-platform/downloads","issues_url":"https://api.github.com/repos/edx/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-platform/releases{/id}","created_at":"2013-05-30T20:20:38Z","updated_at":"2014-08-09T16:26:52Z","pushed_at":"2014-08-11T08:15:40Z","git_url":"git://github.com/edx/edx-platform.git","ssh_url":"git@github.com:edx/edx-platform.git","clone_url":"https://github.com/edx/edx-platform.git","svn_url":"https://github.com/edx/edx-platform","homepage":"http://openedx.org/","size":1542175,"stargazers_count":1355,"watchers_count":1355,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":757,"mirror_url":null,"open_issues_count":110,"forks":757,"open_issues":110,"watchers":1355,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/4735"},"html":{"href":"https://github.com/edx/edx-platform/pull/4735"},"issue":{"href":"https://api.github.com/repos/edx/edx-platform/issues/4735"},"comments":{"href":"https://api.github.com/repos/edx/edx-platform/issues/4735/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/4735/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/4735/commits"},"statuses":{"href":"https://api.github.com/repos/edx/edx-platform/statuses/2a6fe266000ec39d59f89eb2d55c83ba6d20c8a8"}}}}