Skip to content

Commit fbd1709

Browse files
committed
review comments
1 parent 040a1d6 commit fbd1709

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

featuremanagement/_time_window_filter/_models.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,10 @@ def __init__(self, pattern_data: Dict[str, Any]):
7676
self.interval = pattern_data.get("Interval", 1)
7777
if self.interval <= 0:
7878
raise ValueError("The interval must be greater than 0.")
79-
# Days of the week are represented as a list of strings of there names.
79+
# Days of the week are represented as a list of strings of their names.
8080
days_of_week_str = pattern_data.get("DaysOfWeek", [])
8181

8282
# Days of the week are represented as a list of integers from 0 to 6.
83-
# 0 = Sunday, 1 = Monday, ..., 6 = Saturday
8483
self.days_of_week = []
8584
for day in days_of_week_str:
8685
self.days_of_week.append(self.days.index(day))

featuremanagement/_time_window_filter/_recurrence_validator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def _is_duration_compliant_with_days_of_week(pattern: RecurrencePattern, start:
111111
# Get the date of first day of the week
112112
today = datetime.now()
113113
first_day_of_week = pattern.first_day_of_week
114-
offset = _get_passed_week_days(today.weekday(), first_day_of_week)
114+
offset = _get_passed_week_days((today.weekday() + 1) % 7, first_day_of_week)
115115
first_date_of_week = today - timedelta(days=offset)
116116
sorted_days_of_week = _sort_days_of_week(days_of_week, first_day_of_week)
117117

@@ -144,8 +144,8 @@ def _is_duration_compliant_with_days_of_week(pattern: RecurrencePattern, start:
144144
def _get_passed_week_days(current_day: int, first_day_of_week: int) -> int:
145145
"""
146146
Get the number of days passed since the first day of the week.
147-
:param int current_day: The current day of the week, where Monday == 0 ... Sunday == 6.
148-
:param int first_day_of_week: The first day of the week (0-6), where Monday == 0 ... Sunday == 6.
147+
:param int current_day: The current day of the week, where Sunday == 0 ... Saturday == 6.
148+
:param int first_day_of_week: The first day of the week (0-6), where Sunday == 0 ... Saturday == 6.
149149
:return: The number of days passed since the first day of the week.
150150
:rtype: int
151151
"""

featuremanagement/_time_window_filter/conversiontest.py

Whitespace-only changes.

tests/time_window_filter/test_recurrence_validator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# -------------------------------------------------------------------------
66
from datetime import timedelta, datetime
77
import pytest
8-
from time_window_filter.recurrence_util import (
8+
from .recurrence_util import (
99
valid_daily_recurrence,
1010
valid_daily_end_date_recurrence,
1111
valid_no_end_range,

0 commit comments

Comments
 (0)