Skip to content

Commit

Permalink
feat: improve loggging for compare_catalog_queries_to_filters
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnagro committed Sep 29, 2023
1 parent 9b3c882 commit c09e719
Showing 1 changed file with 22 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,26 @@ def handle(self, *args, **options):
logger.info('compare_catalog_queries_to_filters starting...')
for content_metadata in ContentMetadata.objects.filter(content_type=COURSE):
for enterprise_catalog in EnterpriseCatalog.objects.all():
discovery_included = content_metadata in enterprise_catalog.content_metadata
match = filters.does_query_match_content(
enterprise_catalog.catalog_query.content_filter,
content_metadata.json_metadata
)
logger.info(
'compare_catalog_queries_to_filters '
f'enterprise_catalog={enterprise_catalog.uuid}, '
f'content_metadata={content_metadata.content_key}, '
f'discovery_included={discovery_included}, '
f'filter_match={match}'
)
try:
discovery_included = content_metadata in enterprise_catalog.content_metadata
match = filters.does_query_match_content(
enterprise_catalog.catalog_query.content_filter,
content_metadata.json_metadata
)
does_discovery_agree_with_filter = discovery_included == match
logger.info(
'compare_catalog_queries_to_filters '
f'enterprise_catalog={enterprise_catalog.uuid}, '
f'content_key={content_metadata.content_key}, '
f'discovery_included={discovery_included}, '
f'filter_match={match}, '
f'does_discovery_agree_with_filter={does_discovery_agree_with_filter}'
)
except Exception:
logger.exception(

Check warning on line 44 in enterprise_catalog/apps/catalog/management/commands/compare_catalog_queries_to_filters.py

View check run for this annotation

Codecov / codecov/patch

enterprise_catalog/apps/catalog/management/commands/compare_catalog_queries_to_filters.py#L43-L44

Added lines #L43 - L44 were not covered by tests
'compare_catalog_queries_to_filters '
'filter exception '
f'enterprise_catalog={enterprise_catalog.uuid}, '
f'content_metadata={content_metadata.content_key}'
)
logger.info('compare_catalog_queries_to_filters complete.')

0 comments on commit c09e719

Please sign in to comment.