- date = params.get_str('date', todays_date())
- day = Day.by_date(conn, date, create=True)
- return self.server.jinja.get_template('day.html').render(day=day)
-
- def do_GET_process(self, conn: DatabaseConnection,
- params: ParamsParser) -> str:
- """Show process of ?id=."""
- id_ = params.get_int_or_none('id')
- process = Process.by_id(conn, id_, create=True)
- return self.server.jinja.get_template('process.html').render(
- process=process, children=process.get_descendants(conn),
- candidates=Process.all(conn))
-
- def do_GET_processes(self, conn: DatabaseConnection,
- _: ParamsParser) -> str:
+ date = self.params.get_str('date', todays_date())
+ todays_todos = Todo.by_date(self.conn, date)
+ conditions_present = []
+ enablers_for = {}
+ for todo in todays_todos:
+ for condition in todo.conditions:
+ if condition not in conditions_present:
+ conditions_present += [condition]
+ enablers_for[condition.id_] = [p for p in
+ Process.all(self.conn)
+ if condition in p.enables]
+ 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),
+ 'top_nodes': top_nodes,
+ 'enablers_for': enablers_for,
+ 'conditions_present': conditions_present,
+ 'processes': Process.all(self.conn)}
+
+ def do_GET_todo(self) -> dict[str, object]:
+ """Show single Todo of ?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.date),
+ 'condition_candidates': Condition.all(self.conn)}
+
+ def do_GET_conditions(self) -> dict[str, object]:
+ """Show all Conditions."""
+ return {'conditions': Condition.all(self.conn)}
+
+ def do_GET_condition(self) -> dict[str, object]:
+ """Show Condition of ?id=."""
+ id_ = self.params.get_int_or_none('id')
+ return {'condition': Condition.by_id(self.conn, id_, create=True)}
+
+ def do_GET_condition_titles(self) -> dict[str, object]:
+ """Show title history of Condition of ?id=."""
+ id_ = self.params.get_int_or_none('id')
+ condition = Condition.by_id(self.conn, id_)
+ return {'condition': condition}
+
+ def do_GET_condition_descriptions(self) -> dict[str, object]:
+ """Show description historys of Condition of ?id=."""
+ id_ = self.params.get_int_or_none('id')
+ condition = Condition.by_id(self.conn, id_)
+ return {'condition': condition}
+
+ def do_GET_process(self) -> dict[str, object]:
+ """Show Process of ?id=."""
+ id_ = self.params.get_int_or_none('id')
+ process = Process.by_id(self.conn, id_, create=True)
+ return {'process': process,
+ 'steps': process.get_steps(self.conn),
+ 'owners': process.used_as_step_by(self.conn),
+ '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]: