Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "feat: support restricted/custom-b2b runs via enterprise_force_include_aggregation_keys" #908

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions enterprise_catalog/apps/api_client/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@

LOGGER = logging.getLogger(__name__)

CUSTOM_B2B_RESTRICTION_TYPE_KEY = 'custom-b2b-enterprise'


class DiscoveryApiClient(BaseOAuthClient):
"""
Expand Down Expand Up @@ -296,8 +294,7 @@ def get_metadata_by_query(self, catalog_query):
raise exc

try:
# NOTE johnnagro: This ONLY supports courses at the moment (NOT programs, leanerpathways, etc).
# NOTE Troy: This now also supports force-including restricted/custom-b2b courses.
# NOTE johnnagro this ONLY supports courses at the moment (NOT programs, leanerpathways, etc)
if forced_aggregation_keys := catalog_query.content_filter.get('enterprise_force_include_aggregation_keys'):
LOGGER.info(
'get_metadata_by_query enterprise_force_include_aggregation_keys seen'
Expand Down Expand Up @@ -327,7 +324,7 @@ def _retrieve_courses(self, offset, request_params):

def get_courses(self, query_params=None):
"""
Return results from the discovery service's /api/v1/courses/ endpoint.
Return results from the discovery service's /courses endpoint.

Arguments:
query_params (dict): additional query params for the rest api endpoint
Expand All @@ -339,11 +336,6 @@ def get_courses(self, query_params=None):
request_params = {
'ordering': 'key',
'limit': DISCOVERY_OFFSET_SIZE,
# ALWAYS include restricted/custom-b2b courses in the search results. Usability/visiblility of restricted
# courses is ultimately controlled at the level of catalog inclusion, but this helper function is designed
# to facilitate fetching specific courses. Therefore, there's no reason to hide anything restricted at this
# level of the code.
'include_restricted': CUSTOM_B2B_RESTRICTION_TYPE_KEY,
}
request_params.update(query_params or {})

Expand Down
Loading