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

feat: improve loggging for compare_catalog_queries_to_filters #684

Merged
merged 1 commit into from
Sep 29, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,26 @@
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.')
Loading