Skip to content

Commit

Permalink
feat: create/use an ENT-CAT count method (#1995)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnagro authored Jan 22, 2024
1 parent 9e4cbee commit 966e18f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ Change Log
Unreleased
----------

[4.10.5]
--------

fix: tweak catalog compare mgmt command


[4.10.4]
--------

Expand Down
2 changes: 1 addition & 1 deletion enterprise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Your project description goes here.
"""

__version__ = "4.10.4"
__version__ = "4.10.5"
10 changes: 10 additions & 0 deletions enterprise/api_client/enterprise_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,16 @@ def get_content_metadata(self, enterprise_customer, enterprise_catalogs=None, co

return list(content_metadata.values())

@UserAPIClient.refresh_token
def get_catalog_content_count(self, catalog_uuid):
"""
Gets the content metadata count for a catalog from the first page of results
"""
api_url = self.get_api_url(self.GET_CONTENT_METADATA_ENDPOINT.format(catalog_uuid))
response = self.client.get(api_url)
response.raise_for_status()
return response.json()['count']

@UserAPIClient.refresh_token
def refresh_catalogs(self, enterprise_catalogs):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def handle(self, *args, **options):
new_content_filter['course_type__exclude'] = 'executive-education-2u'
new_content_filter_json = json.dumps(new_content_filter)
discovery_count = discovery_client.get_catalog_results_from_discovery(new_content_filter).get('count')
enterprise_count = enterprise_catalog_client.get_enterprise_catalog(customer_catalog.uuid).get('count')
enterprise_count = enterprise_catalog_client.get_catalog_content_count(customer_catalog.uuid)
logger.info(
'compare_discovery_and_enterprise_catalogs catalog '
f'{customer_catalog.uuid} '
Expand Down

0 comments on commit 966e18f

Please sign in to comment.