X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;f=plomtask%2Fdays.py;h=23201301bbe792042a361d3f970415c622d80627;hb=a71dbd0fdbc8a03d400c59d0446595a995301d07;hp=92e44b2330b27caf7da9a3fce9ffca8aff3e7bc5;hpb=5a393ec6a77d8f1040763ffa3e9e908f38a0e517;p=plomtask
diff --git a/plomtask/days.py b/plomtask/days.py
index 92e44b2..2320130 100644
--- a/plomtask/days.py
+++ b/plomtask/days.py
@@ -36,8 +36,15 @@ class Day(BaseModel[str]):
@classmethod
def by_id(cls, db_conn: DatabaseConnection, id_: str) -> Day:
- """Extend BaseModel.by_id checking for new/lost .todos."""
- day = super().by_id(db_conn, id_)
+ """Extend BaseModel.by_id
+
+ Checks Todo.days_to_update if we need to a retrieved Day's .todos,
+ and also ensures we're looking for proper dates and not strings like
+ "yesterday" by enforcing the valid_date translation.
+ """
+ assert isinstance(id_, str)
+ possibly_translated_date = valid_date(id_)
+ day = super().by_id(db_conn, possibly_translated_date)
if day.id_ in Todo.days_to_update:
Todo.days_to_update.remove(day.id_)
day.todos = Todo.by_date(db_conn, day.id_)