Skip to content

Commit

Permalink
Capitalise refresh schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
murdo-moj committed Nov 15, 2024
1 parent ed578d3 commit b1409ba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")], ""),
],
)
Expand Down

0 comments on commit b1409ba

Please sign in to comment.