home
·
contact
·
privacy
projects
/
plomtask
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c49e550
)
Avoid confusing Day.by_id_or_create by always translating dating string first, so...
author
Christian Heller
<c.heller@plomlompom.de>
Fri, 21 Jun 2024 16:26:04 +0000
(18:26 +0200)
committer
Christian Heller
<c.heller@plomlompom.de>
Fri, 21 Jun 2024 16:26:04 +0000
(18:26 +0200)
plomtask/days.py
patch
|
blob
|
history
diff --git
a/plomtask/days.py
b/plomtask/days.py
index 92e44b2330b27caf7da9a3fce9ffca8aff3e7bc5..7e6a5cce9177e2450107a111262482b8e5c23c3a 100644
(file)
--- a/
plomtask/days.py
+++ b/
plomtask/days.py
@@
-34,6
+34,13
@@
class Day(BaseModel[str]):
day.todos = Todo.by_date(db_conn, day.id_)
return day
+ @classmethod
+ def by_id_or_create(cls, db_conn: DatabaseConnection, id_: str | None
+ ) -> Day:
+ """Extend BaseModel.by_id to ensure date name translation."""
+ assert isinstance(id_, str)
+ return super().by_id_or_create(db_conn, valid_date(id_))
+
@classmethod
def by_id(cls, db_conn: DatabaseConnection, id_: str) -> Day:
"""Extend BaseModel.by_id checking for new/lost .todos."""