mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 23:27:37 +00:00
Use fixed due date only for comparison in todoist (#43300)
This commit is contained in:
parent
88c4031e57
commit
b00086ca1f
@ -246,7 +246,7 @@ class TodoistProjectDevice(CalendarEventDevice):
|
|||||||
data,
|
data,
|
||||||
labels,
|
labels,
|
||||||
token,
|
token,
|
||||||
latest_task_due_date=None,
|
due_date_days=None,
|
||||||
whitelisted_labels=None,
|
whitelisted_labels=None,
|
||||||
whitelisted_projects=None,
|
whitelisted_projects=None,
|
||||||
):
|
):
|
||||||
@ -255,7 +255,7 @@ class TodoistProjectDevice(CalendarEventDevice):
|
|||||||
data,
|
data,
|
||||||
labels,
|
labels,
|
||||||
token,
|
token,
|
||||||
latest_task_due_date,
|
due_date_days,
|
||||||
whitelisted_labels,
|
whitelisted_labels,
|
||||||
whitelisted_projects,
|
whitelisted_projects,
|
||||||
)
|
)
|
||||||
@ -338,7 +338,7 @@ class TodoistProjectData:
|
|||||||
project_data,
|
project_data,
|
||||||
labels,
|
labels,
|
||||||
api,
|
api,
|
||||||
latest_task_due_date=None,
|
due_date_days=None,
|
||||||
whitelisted_labels=None,
|
whitelisted_labels=None,
|
||||||
whitelisted_projects=None,
|
whitelisted_projects=None,
|
||||||
):
|
):
|
||||||
@ -356,12 +356,12 @@ class TodoistProjectData:
|
|||||||
|
|
||||||
self.all_project_tasks = []
|
self.all_project_tasks = []
|
||||||
|
|
||||||
# The latest date a task can be due (for making lists of everything
|
# The days a task can be due (for making lists of everything
|
||||||
# due today, or everything due in the next week, for example).
|
# due today, or everything due in the next week, for example).
|
||||||
if latest_task_due_date is not None:
|
if due_date_days is not None:
|
||||||
self._latest_due_date = dt.utcnow() + timedelta(days=latest_task_due_date)
|
self._due_date_days = timedelta(days=due_date_days)
|
||||||
else:
|
else:
|
||||||
self._latest_due_date = None
|
self._due_date_days = None
|
||||||
|
|
||||||
# Only tasks with one of these labels will be included.
|
# Only tasks with one of these labels will be included.
|
||||||
if whitelisted_labels is not None:
|
if whitelisted_labels is not None:
|
||||||
@ -409,8 +409,8 @@ class TodoistProjectData:
|
|||||||
if data[DUE] is not None:
|
if data[DUE] is not None:
|
||||||
task[END] = _parse_due_date(data[DUE])
|
task[END] = _parse_due_date(data[DUE])
|
||||||
|
|
||||||
if self._latest_due_date is not None and (
|
if self._due_date_days is not None and (
|
||||||
task[END] > self._latest_due_date
|
task[END] > dt.utcnow() + self._due_date_days
|
||||||
):
|
):
|
||||||
# This task is out of range of our due date;
|
# This task is out of range of our due date;
|
||||||
# it shouldn't be counted.
|
# it shouldn't be counted.
|
||||||
@ -430,7 +430,7 @@ class TodoistProjectData:
|
|||||||
else:
|
else:
|
||||||
# If we ask for everything due before a certain date, don't count
|
# If we ask for everything due before a certain date, don't count
|
||||||
# things which have no due dates.
|
# things which have no due dates.
|
||||||
if self._latest_due_date is not None:
|
if self._due_date_days is not None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# Define values for tasks without due dates
|
# Define values for tasks without due dates
|
||||||
|
Loading…
x
Reference in New Issue
Block a user