{"action":"created","comment":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/comments/57393407","id":57393407,"diff_hunk":"@@ -0,0 +1,52 @@\n+\"\"\"\n+Handles requests for views, returning page frame\n+\"\"\"\n+\n+import logging\n+from urlparse import urljoin\n+\n+from django.conf import settings\n+from django.contrib.auth.decorators import login_required\n+from django.views.decorators.csrf import ensure_csrf_cookie\n+from django.http import Http404\n+\n+from edxmako.shortcuts import render_to_response\n+from openedx.core.djangoapps.programs.utils import get_programs_for_dashboard\n+from learner_dashboard.models import LearnerDashboardConfiguration\n+from student.views import get_course_enrollments\n+\n+\n+log = logging.getLogger(__name__)\n+\n+\n+@login_required\n+@ensure_csrf_cookie\n+def view_programs(requests):\n+    if not LearnerDashboardConfiguration.current().enable_learner_dashboard:\n+        raise Http404(\"learner dashboard not enabled\")\n+\n+    course_enrollments = list(get_course_enrollments(requests.user, None, []))\n+\n+    # Get the programs by courses dictionary from the get_programs_for_dashboard function call\n+    programs_dict = get_programs_for_dashboard(\n+        requests.user,\n+        [enrollment.course_id for enrollment in course_enrollments])\n+\n+    program_list = []\n+    # Extract all the programs from the dictionary above\n+    for programs_by_courses in programs_dict.values():\n+        for program in programs_by_courses:\n+            if program not in program_list:\n+                # Remove duplicates\n+                program['marketing_url'] = urljoin(\n+                    settings.MKTG_URLS.get('ROOT'),\n+                    'xseries' + '/{}'\n+                ).format(program['marketing_slug'])\n+                program_list.append(program)","path":"lms/djangoapps/learner_dashboard/views.py","position":45,"original_position":45,"commit_id":"1f825c902fd83b1a1d64d86e7d6f3adb1589ba5a","original_commit_id":"d432e311fb1d38a6688a408fa5f1229f87fb06ec","user":{"login":"jimabramson","id":1349368,"avatar_url":"https://avatars.githubusercontent.com/u/1349368?v=3","gravatar_id":"","url":"https://api.github.com/users/jimabramson","html_url":"https://github.com/jimabramson","followers_url":"https://api.github.com/users/jimabramson/followers","following_url":"https://api.github.com/users/jimabramson/following{/other_user}","gists_url":"https://api.github.com/users/jimabramson/gists{/gist_id}","starred_url":"https://api.github.com/users/jimabramson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimabramson/subscriptions","organizations_url":"https://api.github.com/users/jimabramson/orgs","repos_url":"https://api.github.com/users/jimabramson/repos","events_url":"https://api.github.com/users/jimabramson/events{/privacy}","received_events_url":"https://api.github.com/users/jimabramson/received_events","type":"User","site_admin":false},"body":"Is there any defined order in which the Programs should be listed?  @marcotuts any thoughts on that?","created_at":"2016-03-24T21:48:24Z","updated_at":"2016-03-24T21:48:24Z","html_url":"https://github.com/edx/edx-platform/pull/11879#discussion_r57393407","pull_request_url":"https://api.github.com/repos/edx/edx-platform/pulls/11879","_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments/57393407"},"html":{"href":"https://github.com/edx/edx-platform/pull/11879#discussion_r57393407"},"pull_request":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/11879"}}},"pull_request":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/11879","id":63737829,"html_url":"https://github.com/edx/edx-platform/pull/11879","diff_url":"https://github.com/edx/edx-platform/pull/11879.diff","patch_url":"https://github.com/edx/edx-platform/pull/11879.patch","issue_url":"https://api.github.com/repos/edx/edx-platform/issues/11879","number":11879,"state":"open","locked":false,"title":"ECOM-3194 Create the listing page of Programs (x-series) which learners have enrolled in","user":{"login":"schenedx","id":16839373,"avatar_url":"https://avatars.githubusercontent.com/u/16839373?v=3","gravatar_id":"","url":"https://api.github.com/users/schenedx","html_url":"https://github.com/schenedx","followers_url":"https://api.github.com/users/schenedx/followers","following_url":"https://api.github.com/users/schenedx/following{/other_user}","gists_url":"https://api.github.com/users/schenedx/gists{/gist_id}","starred_url":"https://api.github.com/users/schenedx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schenedx/subscriptions","organizations_url":"https://api.github.com/users/schenedx/orgs","repos_url":"https://api.github.com/users/schenedx/repos","events_url":"https://api.github.com/users/schenedx/events{/privacy}","received_events_url":"https://api.github.com/users/schenedx/received_events","type":"User","site_admin":false},"body":"WIP\r\n\r\nThis is the new program listing page that will show along side of the learner dashboard.\r\nThe simple logic of the page is complete. \r\nI haven't yet add the config model to turn off this feature yet. I will work on that next.\r\nThen the PR needs unit tests for both the backend and frontend. \r\nPlease review in the mean time on what I have\r\n\r\n@jimabramson @AlasdairSwan @rlucioni ","created_at":"2016-03-22T15:20:01Z","updated_at":"2016-03-24T21:48:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"413457c40932f7a94196e305f9472d33b446acc2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/edx/edx-platform/pulls/11879/commits","review_comments_url":"https://api.github.com/repos/edx/edx-platform/pulls/11879/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/11879/comments","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/1f825c902fd83b1a1d64d86e7d6f3adb1589ba5a","head":{"label":"edx:schen/ECOM-3194","ref":"schen/ECOM-3194","sha":"1f825c902fd83b1a1d64d86e7d6f3adb1589ba5a","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","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=3","gravatar_id":"","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":"The Open edX platform, the software that powers edX!","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}","deployments_url":"https://api.github.com/repos/edx/edx-platform/deployments","created_at":"2013-05-30T20:20:38Z","updated_at":"2016-03-24T19:26:23Z","pushed_at":"2016-03-24T21:46: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://open.edx.org/","size":730352,"stargazers_count":2461,"watchers_count":2461,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1493,"mirror_url":null,"open_issues_count":182,"forks":1493,"open_issues":182,"watchers":2461,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"a0654f93a2dd20f0daa6a56f0e10f1027e6c6ea8","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","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=3","gravatar_id":"","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":"The Open edX platform, the software that powers edX!","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}","deployments_url":"https://api.github.com/repos/edx/edx-platform/deployments","created_at":"2013-05-30T20:20:38Z","updated_at":"2016-03-24T19:26:23Z","pushed_at":"2016-03-24T21:46: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://open.edx.org/","size":730352,"stargazers_count":2461,"watchers_count":2461,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1493,"mirror_url":null,"open_issues_count":182,"forks":1493,"open_issues":182,"watchers":2461,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/11879"},"html":{"href":"https://github.com/edx/edx-platform/pull/11879"},"issue":{"href":"https://api.github.com/repos/edx/edx-platform/issues/11879"},"comments":{"href":"https://api.github.com/repos/edx/edx-platform/issues/11879/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/11879/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/11879/commits"},"statuses":{"href":"https://api.github.com/repos/edx/edx-platform/statuses/1f825c902fd83b1a1d64d86e7d6f3adb1589ba5a"}}}}