X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=plomtask%2Fhttp.py;h=2c7e628bdd14fd572a29c5686a5d3a5a37ceb409;hb=29969c2d0fb6c464662737df1da94f76dc2c0982;hp=cf3288a295794bb94ce816f567158d90adb3befa;hpb=206a9111fdc95fcb24ae4793a7536e1facf82b71;p=plomtask diff --git a/plomtask/http.py b/plomtask/http.py index cf3288a..2c7e628 100644 --- a/plomtask/http.py +++ b/plomtask/http.py @@ -94,8 +94,9 @@ class TaskHandler(BaseHTTPRequestHandler): """Handle any GET request.""" try: self._init_handling() - if self.site in {'calendar', 'day', 'process', 'processes', 'todo', - 'condition', 'conditions'}: + if self.site in {'calendar', 'day', 'process', 'process_titles', + 'process_descriptions', 'process_efforts', + 'processes', 'todo', 'condition', 'conditions'}: template = f'{self.site}.html' ctx = getattr(self, f'do_GET_{self.site}')() html = self.server.jinja.get_template(template).render(**ctx) @@ -156,7 +157,7 @@ class TaskHandler(BaseHTTPRequestHandler): return {'condition': Condition.by_id(self.conn, id_, create=True)} def do_GET_process(self) -> dict[str, object]: - """Show process of ?id=.""" + """Show Process of ?id=.""" id_ = self.params.get_int_or_none('id') process = Process.by_id(self.conn, id_, create=True) return {'process': process, @@ -165,6 +166,24 @@ class TaskHandler(BaseHTTPRequestHandler): 'step_candidates': Process.all(self.conn), 'condition_candidates': Condition.all(self.conn)} + def do_GET_process_titles(self) -> dict[str, object]: + """Show title history of Process of ?id=.""" + id_ = self.params.get_int_or_none('id') + process = Process.by_id(self.conn, id_) + return {'process': process} + + def do_GET_process_descriptions(self) -> dict[str, object]: + """Show description historys of Process of ?id=.""" + id_ = self.params.get_int_or_none('id') + process = Process.by_id(self.conn, id_) + return {'process': process} + + def do_GET_process_efforts(self) -> dict[str, object]: + """Show default effort history of Process of ?id=.""" + id_ = self.params.get_int_or_none('id') + process = Process.by_id(self.conn, id_) + return {'process': process} + def do_GET_processes(self) -> dict[str, object]: """Show all Processes.""" return {'processes': Process.all(self.conn)} @@ -194,7 +213,7 @@ class TaskHandler(BaseHTTPRequestHandler): """Update or insert Day of date and Todos mapped to it.""" date = self.params.get_str('date') day = Day.by_id(self.conn, date, create=True) - day.comment = self.form_data.get_str('comment') + day.comment = self.form_data.get_str('day_comment') day.save(self.conn) new_todos = [] for process_id in self.form_data.get_all_int('new_todo'): @@ -212,9 +231,12 @@ class TaskHandler(BaseHTTPRequestHandler): todo.make_missing_children(self.conn) todo.save(self.conn) done_ids = self.form_data.get_all_int('done') - for todo_id in self.form_data.get_all_int('todo_id'): + comments = self.form_data.get_all_str('comment') + for i, todo_id in enumerate(self.form_data.get_all_int('todo_id')): todo = Todo.by_id(self.conn, todo_id) todo.is_done = todo_id in done_ids + if len(comments) > 0: + todo.comment = comments[i] todo.save(self.conn) for condition in todo.enables: condition.save(self.conn) @@ -245,6 +267,7 @@ class TaskHandler(BaseHTTPRequestHandler): todo.set_enables(self.conn, self.form_data.get_all_int('enables')) todo.set_disables(self.conn, self.form_data.get_all_int('disables')) todo.is_done = len(self.form_data.get_all_str('done')) > 0 + todo.comment = self.form_data.get_str('comment', ignore_strict=True) todo.save(self.conn) for condition in todo.enables: condition.save(self.conn)