home
·
contact
·
privacy
projects
/
plomtask
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Refactor .as_dict integration of Process.explicit_steps, Day.todos.
[plomtask]
/
plomtask
/
days.py
diff --git
a/plomtask/days.py
b/plomtask/days.py
index 0bd942cbd8804b8900a3271b9f4f0e4881f105ec..92e44b2330b27caf7da9a3fce9ffca8aff3e7bc5 100644
(file)
--- a/
plomtask/days.py
+++ b/
plomtask/days.py
@@
-12,6
+12,7
@@
class Day(BaseModel[str]):
"""Individual days defined by their dates."""
table_name = 'days'
to_save = ['comment']
"""Individual days defined by their dates."""
table_name = 'days'
to_save = ['comment']
+ add_to_dict = ['todos']
can_create_by_id = True
def __init__(self, date: str, comment: str = '') -> None:
can_create_by_id = True
def __init__(self, date: str, comment: str = '') -> None:
@@
-24,13
+25,6
@@
class Day(BaseModel[str]):
def __lt__(self, other: Day) -> bool:
return self.date < other.date
def __lt__(self, other: Day) -> bool:
return self.date < other.date
- @property
- def as_dict(self) -> dict[str, object]:
- """Return self as (json.dumps-coompatible) dict."""
- d = super().as_dict
- d['todos'] = [t.as_dict for t in self.todos]
- return d
-
@classmethod
def from_table_row(cls, db_conn: DatabaseConnection, row: Row | list[Any]
) -> Day:
@classmethod
def from_table_row(cls, db_conn: DatabaseConnection, row: Row | list[Any]
) -> Day: