X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;ds=sidebyside;f=plomtask%2Ftodos.py;h=008f7a275ab42aa9bbbcfed1933c81f491854211;hb=5ced0155ad11f5fb87aaa0848402e95f8ff49acd;hp=0125b97809350de3c991d332d80c7adfbaf583ce;hpb=4691a05e64acb2239f9d449b36f4ff5c678a1d6c;p=plomtask
diff --git a/plomtask/todos.py b/plomtask/todos.py
index 0125b97..008f7a2 100644
--- a/plomtask/todos.py
+++ b/plomtask/todos.py
@@ -23,6 +23,7 @@ class TodoNode:
class Todo(BaseModel[int], ConditionsRelations):
"""Individual actionable."""
# pylint: disable=too-many-instance-attributes
+ # pylint: disable=too-many-public-methods
table_name = 'todos'
to_save = ['process_id', 'is_done', 'date', 'comment', 'effort',
'calendarize']
@@ -154,6 +155,16 @@ class Todo(BaseModel[int], ConditionsRelations):
"""Collect all Todos for Day of date."""
return cls.by_date_range(db_conn, (date, date))
+ @classmethod
+ def total_effort_at_date(cls, db_conn: DatabaseConnection, date: str
+ ) -> float:
+ """Sum all .performed_effort of Todos at Day of date."""
+ total_effort = 0.0
+ days_todos = cls.by_date(db_conn, date)
+ for todo in days_todos:
+ total_effort += todo.performed_effort
+ return total_effort
+
@property
def is_doable(self) -> bool:
"""Decide whether .is_done settable based on children, Conditions."""