- def by_id(cls,
- db_conn: DatabaseConnection, id_: str | None,
- create: bool = False,
- init_empty_todo_list: bool = False
- ) -> Day:
- """Extend BaseModel.by_id with init_empty_todo_list flag."""
- # pylint: disable=protected-access
- # (since on ._todo we're only meddling within cls)
- day = super().by_id(db_conn, id_, create)
- if init_empty_todo_list and day._todos is None:
- day._todos = []
+ 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_)
+ if day.id_ in Todo.days_to_update:
+ Todo.days_to_update.remove(day.id_)
+ day.todos = Todo.by_date(db_conn, day.id_)