X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=plomtask%2Fhttp.py;fp=plomtask%2Fhttp.py;h=230ed3f26c5d53398a27d87558a28abeb28ceff5;hb=344d6c234e50953b36ac9fed2cfce8d4ba64a5b3;hp=91db32601c24c91c49db75df4f9ca2b05fd9b944;hpb=5ced0155ad11f5fb87aaa0848402e95f8ff49acd;p=plomtask diff --git a/plomtask/http.py b/plomtask/http.py index 91db326..230ed3f 100644 --- a/plomtask/http.py +++ b/plomtask/http.py @@ -205,12 +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) 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] @@ -222,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': Todo.total_effort_at_date(self.conn, date), + for t in day.todos if not t.parents] + return {'day': day, 'top_nodes': top_nodes, 'make_type': make_type, 'enablers_for': enablers_for,