X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/balance2?a=blobdiff_plain;f=plomtask%2Fhttp.py;h=cc4358cfbf0365659fa89750e941c99533fd9a40;hb=2d0d3a138de69e5e09208936ac094b53b0785c0b;hp=a14233ae9cb81e0d65c18bbaf37497e63ab311e2;hpb=c5fab0b28785bb8f3a8e2b8e455fd679cfe83d25;p=plomtask diff --git a/plomtask/http.py b/plomtask/http.py index a14233a..cc4358c 100644 --- a/plomtask/http.py +++ b/plomtask/http.py @@ -127,17 +127,17 @@ class TaskHandler(BaseHTTPRequestHandler): 'condition': condition, 'enablers': enablers, 'disablers': disablers}] - return {'day': Day.by_date(self.conn, date, create=True), + return {'day': Day.by_id(self.conn, date, create=True), 'todos': Todo.by_date(self.conn, date), 'processes': Process.all(self.conn), 'conditions_listing': conditions_listing} def do_GET_todo(self) -> dict[str, object]: """Show single Todo of ?id=.""" - id_ = self.params.get_int_or_none('id') + id_ = self.params.get_int('id') todo = Todo.by_id(self.conn, id_) return {'todo': todo, - 'todo_candidates': Todo.by_date(self.conn, todo.day.date), + 'todo_candidates': Todo.by_date(self.conn, todo.date), 'condition_candidates': Condition.all(self.conn)} def do_GET_conditions(self) -> dict[str, object]: @@ -187,18 +187,18 @@ class TaskHandler(BaseHTTPRequestHandler): def do_POST_day(self) -> None: """Update or insert Day of date and Todos mapped to it.""" date = self.params.get_str('date') - day = Day.by_date(self.conn, date, create=True) + day = Day.by_id(self.conn, date, create=True) day.comment = self.form_data.get_str('comment') day.save(self.conn) process_id = self.form_data.get_int_or_none('new_todo') if process_id is not None: process = Process.by_id(self.conn, process_id) - todo = Todo(None, process, False, day) + todo = Todo(None, process, False, day.date) todo.save(self.conn) def do_POST_todo(self) -> None: """Update Todo and its children.""" - id_ = self.params.get_int_or_none('id') + id_ = self.params.get_int('id') todo = Todo.by_id(self.conn, id_) child_id = self.form_data.get_int_or_none('adopt') if child_id is not None: