{"action":"created","comment":{"url":"https://api.github.com/repos/edx/course-discovery/pulls/comments/63012890","id":63012890,"diff_hunk":"@@ -183,6 +183,43 @@ def retrieve(self, request, *args, **kwargs):\n         \"\"\" Retrieve details for a course run. \"\"\"\n         return super(CourseRunViewSet, self).retrieve(request, *args, **kwargs)\n \n+    @list_route()\n+    def contains(self, request):\n+        \"\"\"\n+        Determine if seat types for specific courses are found in the query results.\n+\n+        A dictionary mapping course IDs to seat types and seat types to booleans,\n+        indicating course seat presence, will be returned.\n+        ---\n+        parameters:\n+            - query: Dynamic Catalog query to be parsed by Elasticsearch\n+              course_ids: List of course IDs.\n+              seat_types: List of seat types.\n+        \"\"\"\n+        query = request.GET.get('query')\n+        course_ids = request.GET.get('course_ids', '').split(',')\n+        seat_types = request.GET.get('seat_types', '').lower().split(',')\n+\n+        contains = {\n+            course_id: {\n+                seat_type: False for seat_type in seat_types\n+            }\n+            for course_id in course_ids\n+        }\n+\n+        if query:\n+            course_run_keys = CourseRun.search(query).values_list('key', flat=True)","path":"course_discovery/apps/api/v1/views.py","position":null,"original_position":29,"commit_id":"3b293a0d2c764d475470b17279b577cb45a78129","original_commit_id":"ae051283ce37ffba8d32a81fb303e4e3db9f0839","user":{"login":"clintonb","id":910510,"avatar_url":"https://avatars.githubusercontent.com/u/910510?v=3","gravatar_id":"","url":"https://api.github.com/users/clintonb","html_url":"https://github.com/clintonb","followers_url":"https://api.github.com/users/clintonb/followers","following_url":"https://api.github.com/users/clintonb/following{/other_user}","gists_url":"https://api.github.com/users/clintonb/gists{/gist_id}","starred_url":"https://api.github.com/users/clintonb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clintonb/subscriptions","organizations_url":"https://api.github.com/users/clintonb/orgs","repos_url":"https://api.github.com/users/clintonb/repos","events_url":"https://api.github.com/users/clintonb/events{/privacy}","received_events_url":"https://api.github.com/users/clintonb/received_events","type":"User","site_admin":false},"body":"I don't have time to investigate, but note that `CourseRun.search()` returns a [`SearchQuerySet`](http://django-haystack.readthedocs.io/en/v2.4.1/searchqueryset_api.html). You can probably disregard my comments about `values_list`.","created_at":"2016-05-12T12:44:29Z","updated_at":"2016-05-12T12:44:29Z","html_url":"https://github.com/edx/course-discovery/pull/91#discussion_r63012890","pull_request_url":"https://api.github.com/repos/edx/course-discovery/pulls/91","_links":{"self":{"href":"https://api.github.com/repos/edx/course-discovery/pulls/comments/63012890"},"html":{"href":"https://github.com/edx/course-discovery/pull/91#discussion_r63012890"},"pull_request":{"href":"https://api.github.com/repos/edx/course-discovery/pulls/91"}}},"pull_request":{"url":"https://api.github.com/repos/edx/course-discovery/pulls/91","id":68875033,"html_url":"https://github.com/edx/course-discovery/pull/91","diff_url":"https://github.com/edx/course-discovery/pull/91.diff","patch_url":"https://github.com/edx/course-discovery/pull/91.patch","issue_url":"https://api.github.com/repos/edx/course-discovery/issues/91","number":91,"state":"open","locked":false,"title":"[SOL-1772] Add seat type query API endpoint","user":{"login":"marjev","id":6833568,"avatar_url":"https://avatars.githubusercontent.com/u/6833568?v=3","gravatar_id":"","url":"https://api.github.com/users/marjev","html_url":"https://github.com/marjev","followers_url":"https://api.github.com/users/marjev/followers","following_url":"https://api.github.com/users/marjev/following{/other_user}","gists_url":"https://api.github.com/users/marjev/gists{/gist_id}","starred_url":"https://api.github.com/users/marjev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marjev/subscriptions","organizations_url":"https://api.github.com/users/marjev/orgs","repos_url":"https://api.github.com/users/marjev/repos","events_url":"https://api.github.com/users/marjev/events{/privacy}","received_events_url":"https://api.github.com/users/marjev/received_events","type":"User","site_admin":false},"body":"@mjfrey Can you take a look at this to let me know if I'm on the right track?","created_at":"2016-05-04T14:50:40Z","updated_at":"2016-05-12T12:44:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9af76bf0c6d244054057f7453b13b0ab22431544","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/edx/course-discovery/pulls/91/commits","review_comments_url":"https://api.github.com/repos/edx/course-discovery/pulls/91/comments","review_comment_url":"https://api.github.com/repos/edx/course-discovery/pulls/comments{/number}","comments_url":"https://api.github.com/repos/edx/course-discovery/issues/91/comments","statuses_url":"https://api.github.com/repos/edx/course-discovery/statuses/3b293a0d2c764d475470b17279b577cb45a78129","head":{"label":"edx:mjevtic/SOL-1771","ref":"mjevtic/SOL-1771","sha":"3b293a0d2c764d475470b17279b577cb45a78129","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":45866355,"name":"course-discovery","full_name":"edx/course-discovery","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/course-discovery","description":"edX course discovery API","fork":false,"url":"https://api.github.com/repos/edx/course-discovery","forks_url":"https://api.github.com/repos/edx/course-discovery/forks","keys_url":"https://api.github.com/repos/edx/course-discovery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/course-discovery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/course-discovery/teams","hooks_url":"https://api.github.com/repos/edx/course-discovery/hooks","issue_events_url":"https://api.github.com/repos/edx/course-discovery/issues/events{/number}","events_url":"https://api.github.com/repos/edx/course-discovery/events","assignees_url":"https://api.github.com/repos/edx/course-discovery/assignees{/user}","branches_url":"https://api.github.com/repos/edx/course-discovery/branches{/branch}","tags_url":"https://api.github.com/repos/edx/course-discovery/tags","blobs_url":"https://api.github.com/repos/edx/course-discovery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/course-discovery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/course-discovery/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/course-discovery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/course-discovery/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/course-discovery/languages","stargazers_url":"https://api.github.com/repos/edx/course-discovery/stargazers","contributors_url":"https://api.github.com/repos/edx/course-discovery/contributors","subscribers_url":"https://api.github.com/repos/edx/course-discovery/subscribers","subscription_url":"https://api.github.com/repos/edx/course-discovery/subscription","commits_url":"https://api.github.com/repos/edx/course-discovery/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/course-discovery/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/course-discovery/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/course-discovery/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/course-discovery/contents/{+path}","compare_url":"https://api.github.com/repos/edx/course-discovery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/course-discovery/merges","archive_url":"https://api.github.com/repos/edx/course-discovery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/course-discovery/downloads","issues_url":"https://api.github.com/repos/edx/course-discovery/issues{/number}","pulls_url":"https://api.github.com/repos/edx/course-discovery/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/course-discovery/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/course-discovery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/course-discovery/labels{/name}","releases_url":"https://api.github.com/repos/edx/course-discovery/releases{/id}","deployments_url":"https://api.github.com/repos/edx/course-discovery/deployments","created_at":"2015-11-09T20:57:54Z","updated_at":"2016-01-29T03:03:54Z","pushed_at":"2016-05-12T12:26:01Z","git_url":"git://github.com/edx/course-discovery.git","ssh_url":"git@github.com:edx/course-discovery.git","clone_url":"https://github.com/edx/course-discovery.git","svn_url":"https://github.com/edx/course-discovery","homepage":null,"size":380,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":3,"forks":5,"open_issues":3,"watchers":3,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"b2a6949560899f01f779a0231b277b941bff9ff3","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":45866355,"name":"course-discovery","full_name":"edx/course-discovery","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/course-discovery","description":"edX course discovery API","fork":false,"url":"https://api.github.com/repos/edx/course-discovery","forks_url":"https://api.github.com/repos/edx/course-discovery/forks","keys_url":"https://api.github.com/repos/edx/course-discovery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/course-discovery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/course-discovery/teams","hooks_url":"https://api.github.com/repos/edx/course-discovery/hooks","issue_events_url":"https://api.github.com/repos/edx/course-discovery/issues/events{/number}","events_url":"https://api.github.com/repos/edx/course-discovery/events","assignees_url":"https://api.github.com/repos/edx/course-discovery/assignees{/user}","branches_url":"https://api.github.com/repos/edx/course-discovery/branches{/branch}","tags_url":"https://api.github.com/repos/edx/course-discovery/tags","blobs_url":"https://api.github.com/repos/edx/course-discovery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/course-discovery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/course-discovery/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/course-discovery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/course-discovery/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/course-discovery/languages","stargazers_url":"https://api.github.com/repos/edx/course-discovery/stargazers","contributors_url":"https://api.github.com/repos/edx/course-discovery/contributors","subscribers_url":"https://api.github.com/repos/edx/course-discovery/subscribers","subscription_url":"https://api.github.com/repos/edx/course-discovery/subscription","commits_url":"https://api.github.com/repos/edx/course-discovery/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/course-discovery/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/course-discovery/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/course-discovery/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/course-discovery/contents/{+path}","compare_url":"https://api.github.com/repos/edx/course-discovery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/course-discovery/merges","archive_url":"https://api.github.com/repos/edx/course-discovery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/course-discovery/downloads","issues_url":"https://api.github.com/repos/edx/course-discovery/issues{/number}","pulls_url":"https://api.github.com/repos/edx/course-discovery/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/course-discovery/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/course-discovery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/course-discovery/labels{/name}","releases_url":"https://api.github.com/repos/edx/course-discovery/releases{/id}","deployments_url":"https://api.github.com/repos/edx/course-discovery/deployments","created_at":"2015-11-09T20:57:54Z","updated_at":"2016-01-29T03:03:54Z","pushed_at":"2016-05-12T12:26:01Z","git_url":"git://github.com/edx/course-discovery.git","ssh_url":"git@github.com:edx/course-discovery.git","clone_url":"https://github.com/edx/course-discovery.git","svn_url":"https://github.com/edx/course-discovery","homepage":null,"size":380,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":3,"forks":5,"open_issues":3,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/course-discovery/pulls/91"},"html":{"href":"https://github.com/edx/course-discovery/pull/91"},"issue":{"href":"https://api.github.com/repos/edx/course-discovery/issues/91"},"comments":{"href":"https://api.github.com/repos/edx/course-discovery/issues/91/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/course-discovery/pulls/91/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/course-discovery/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/edx/course-discovery/pulls/91/commits"},"statuses":{"href":"https://api.github.com/repos/edx/course-discovery/statuses/3b293a0d2c764d475470b17279b577cb45a78129"}}}}