Skip to content

Commit

Permalink
feat: improve loggging for compare_catalog_queries_to_filters (#684)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnagro authored Sep 29, 2023
1 parent 6a15a55 commit 874c39c
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(
'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 874c39c

Please sign in to comment.