Skip to content

Commit

Permalink
[Fix] convert scheduled color string to list
Browse files Browse the repository at this point in the history
Better solution to #159
  • Loading branch information
Drazzilb08 committed Jul 3, 2024
1 parent 4785377 commit c0771eb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions modules/border_replacerr.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,20 @@ def check_holiday(data, border_colors, logger):
# Iterate through each holiday and its corresponding schedule and color in the data
for holiday, schedule_color in data.items():
schedule = schedule_color.get('schedule', None)

# If schedule exists for the holiday
if schedule:

# Check if the schedule matches the range pattern
if re.match(pattern, schedule):

# If 'check_schedule' returns True (indicating successful execution)
if check_schedule(script_name, schedule, logger):
# Retrieve the color for the holiday from schedule_color or use default border_colors
holiday_colors = schedule_color.get('color', border_colors)

# If holiday color is string convert to list
if isinstance(holiday_colors, str):
holiday_colors = [holiday_colors]
# If holiday_colors exist, log the schedule execution and colors being used
if holiday_colors:
table = [
Expand Down

0 comments on commit c0771eb

Please sign in to comment.