Skip to content

Commit

Permalink
Fix collection day move if holiday is in week and after the collectio…
Browse files Browse the repository at this point in the history
…n day (bruxy70#175)

* If a holiday is in the same week as the collection day and
the holiday is after the collection day, it makes no sense to move
the collection day to the following day, as the holiday is already over
on collection day.
  • Loading branch information
chriss158 committed Jun 24, 2020
1 parent eff68fe commit 937d4a7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions custom_components/garbage_collection/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,9 +453,8 @@ async def __async_candidate_with_include_exclude_dates(self, day1: date) -> date

if bool(self.__holiday_in_week_move):
start_date = next_date - timedelta(days=next_date.weekday())
end_date = start_date + timedelta(days=6)
delta = timedelta(days=1)
while start_date <= end_date:
while start_date <= next_date:
if start_date in self.__holidays:
_LOGGER.debug(
"(%s) Move possible collection day, because public holiday in week on %s",
Expand Down

0 comments on commit 937d4a7

Please sign in to comment.