diff --git a/lib/datahub-client/data_platform_catalogue/client/graphql_helpers.py b/lib/datahub-client/data_platform_catalogue/client/graphql_helpers.py index 22b49045..fe2a77d7 100644 --- a/lib/datahub-client/data_platform_catalogue/client/graphql_helpers.py +++ b/lib/datahub-client/data_platform_catalogue/client/graphql_helpers.py @@ -182,20 +182,20 @@ def get_refresh_period_from_cadet_tags( refresh_schedules: list[str] = ["daily", "weekly", "monthly"] ) -> str: # Check if any of the tags are refresh period tags eg "daily_opg" - refresh_period_tags = [ + relevant_refresh_schedules = [ schedule for tag_ref in tags for schedule in refresh_schedules if schedule in tag_ref.display_name ] - if len(refresh_period_tags) > 1: + if len(relevant_refresh_schedules) > 1: logger.warn(f"More than one refresh period tag found: {tags=}") - if refresh_period_tags: - refresh_schedule = refresh_period_tags[0].capitalize() + if relevant_refresh_schedules: + refresh_schedule = relevant_refresh_schedules[0].capitalize() return refresh_schedule - if not refresh_period_tags: + if not relevant_refresh_schedules: return "" diff --git a/lib/datahub-client/tests/client/datahub/test_graphql_helpers.py b/lib/datahub-client/tests/client/datahub/test_graphql_helpers.py index 96c09293..61b998d3 100644 --- a/lib/datahub-client/tests/client/datahub/test_graphql_helpers.py +++ b/lib/datahub-client/tests/client/datahub/test_graphql_helpers.py @@ -663,8 +663,8 @@ def test_parse_updated(): @pytest.mark.parametrize( "tags, expected_refresh_period", [ - ([TagRef(display_name="daily_opg", urn="urn:li:tag:daily_opg")], "daily"), - ([TagRef(display_name="monthly", urn="urn:li:tag:monthly")], "monthly"), + ([TagRef(display_name="daily_opg", urn="urn:li:tag:daily_opg")], "Daily"), + ([TagRef(display_name="monthly", urn="urn:li:tag:monthly")], "Monthly"), ([TagRef(display_name="dc_cadet", urn="urn:li:tag:dc_cadet")], ""), ], )