Skip to content

Commit

Permalink
feat: tweaks for better data (#1996)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnagro authored Jan 22, 2024
1 parent 966e18f commit 1ac2e15
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 13 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.6]
--------

fix: tweak catalog compare mgmt command


[4.10.5]
--------

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.5"
__version__ = "4.10.6"
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import json
import logging

from requests.exceptions import HTTPError

from django.core.management import BaseCommand

from enterprise.api_client.discovery import CourseCatalogApiServiceClient
Expand Down Expand Up @@ -43,6 +45,13 @@ def handle(self, *args, **options):
)
continue

if catalog_query.content_filter.get('aggregation_key'):
logger.info(
'compare_discovery_and_enterprise_catalogs '
f'query {catalog_query.id} references aggregation_key somehow'
)
continue

new_content_filter = copy.deepcopy(catalog_query.content_filter)
new_content_filter['course_type__exclude'] = 'executive-education-2u'
new_content_filter_json = json.dumps(new_content_filter)
Expand All @@ -62,15 +71,24 @@ def handle(self, *args, **options):
)
continue

new_content_filter = copy.deepcopy(customer_catalog.content_filter)
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_catalog_content_count(customer_catalog.uuid)
logger.info(
'compare_discovery_and_enterprise_catalogs catalog '
f'{customer_catalog.uuid} '
f'discovery count: {discovery_count}, '
f'enterprise count: {enterprise_count}, '
f'new filter: {new_content_filter_json}'
)
try:
old_content_filter = customer_catalog.content_filter
new_content_filter = copy.deepcopy(customer_catalog.content_filter)
new_content_filter['course_type__exclude'] = 'executive-education-2u'
new_content_filter_json = json.dumps(new_content_filter)
old_discovery_count = discovery_client.get_catalog_results_from_discovery(old_content_filter).get('count') # pylint: disable=line-too-long
new_discovery_count = discovery_client.get_catalog_results_from_discovery(new_content_filter).get('count') # pylint: disable=line-too-long
enterprise_count = enterprise_catalog_client.get_catalog_content_count(customer_catalog.uuid)
logger.info(
'compare_discovery_and_enterprise_catalogs catalog '
f'{customer_catalog.uuid} '
f'existing discovery count: {old_discovery_count}, '
f'new discovery count: {new_discovery_count}, '
f'existing enterprise count: {enterprise_count}, '
f'new filter: {new_content_filter_json}'
)
except HTTPError:
logger.exception(
'compare_discovery_and_enterprise_catalogs '
f'error checking catalog {customer_catalog.uuid}'
)

0 comments on commit 1ac2e15

Please sign in to comment.