X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=plomtask%2Fhttp.py;h=230ed3f26c5d53398a27d87558a28abeb28ceff5;hb=99672306cdb97d76d00829b2e491f2df0abcbbd5;hp=3d507be9b344ff8be7ca26952bfa422872ec6b78;hpb=47214d1d93d988deb3d0fc828f7fd35075e6d073;p=plomtask diff --git a/plomtask/http.py b/plomtask/http.py index 3d507be..230ed3f 100644 --- a/plomtask/http.py +++ b/plomtask/http.py @@ -191,8 +191,6 @@ class TaskHandler(BaseHTTPRequestHandler): ret = Day.by_date_range_with_limits(self.conn, (start, end), 'id') days, start, end = ret days = Day.with_filled_gaps(days, start, end) - for day in days: - day.collect_calendarized_todos(self.conn) today = date_in_n_days(0) return {'start': start, 'end': end, 'days': days, 'today': today} @@ -207,15 +205,13 @@ class TaskHandler(BaseHTTPRequestHandler): def do_GET_day(self) -> dict[str, object]: """Show single Day of ?date=.""" date = self._params.get_str('date', date_in_n_days(0)) + day = Day.by_id(self.conn, date, create=True, + init_empty_todo_list=True) make_type = self._params.get_str('make_type') - todays_todos = Todo.by_date(self.conn, date) - total_effort = 0.0 - for todo in todays_todos: - total_effort += todo.performed_effort conditions_present = [] enablers_for = {} disablers_for = {} - for todo in todays_todos: + for todo in day.todos: for condition in todo.conditions + todo.blockers: if condition not in conditions_present: conditions_present += [condition] @@ -227,9 +223,8 @@ class TaskHandler(BaseHTTPRequestHandler): if condition in p.disables] seen_todos: set[int] = set() top_nodes = [t.get_step_tree(seen_todos) - for t in todays_todos if not t.parents] - return {'day': Day.by_id(self.conn, date, create=True), - 'total_effort': total_effort, + for t in day.todos if not t.parents] + return {'day': day, 'top_nodes': top_nodes, 'make_type': make_type, 'enablers_for': enablers_for,