From: Christian Heller Date: Wed, 5 Jun 2024 17:18:04 +0000 (+0200) Subject: Improve day done tree display. X-Git-Url: https://plomlompom.com/repos/index.html?a=commitdiff_plain;h=80025e0b2d278a44852b6a397184d1f71c2075fe;p=plomtask Improve day done tree display. --- diff --git a/plomtask/todos.py b/plomtask/todos.py index 775ef48..69a19c9 100644 --- a/plomtask/todos.py +++ b/plomtask/todos.py @@ -214,6 +214,18 @@ class Todo(BaseModel[int], ConditionsRelations): assert isinstance(effort_then, float) return effort_then + @property + def has_doneness_in_path(self) -> bool: + """Check whether self is done or has any children that are.""" + if self.is_done: + return True + for child in self.children: + if child.is_done: + return True + if child.has_doneness_in_path: + return True + return False + def get_step_tree(self, seen_todos: set[int]) -> TodoNode: """Return tree of depended-on Todos.""" diff --git a/templates/day.html b/templates/day.html index 627923b..3b2e96a 100644 --- a/templates/day.html +++ b/templates/day.html @@ -16,11 +16,11 @@ th { } td.cond_line_0 { border-top: 1px solid white; - background-color: #dddddd; + background-color: #bfbfbf; } td.cond_line_1 { border-top: 1px solid white; - background-color: #efefef; + background-color: #dfdfdf; } td.cond_line_2 { border-top: 1px solid white; @@ -33,11 +33,14 @@ td.cond_line_corner { text-overflow: clip; } td.todo_line { - border-bottom: 1px solid #dddddd; + border-bottom: 1px solid #bfbfbf; height: 1.7em; } tr.inactive td.todo_line { - background-color: #dddddd; + background-color: #bfbfbf; +} +tr.hidden_undone td, tr.hidden_undone a { + color: #9f9f9f; } td.left_border { border-left: 1px solid black; @@ -110,33 +113,21 @@ O  {% macro show_node_done(node, indent, path) %} -{% if node.todo.is_done %} - - -{% if path|length > 0 and not path[-1].todo.is_done %} - -({% for path_node in path %}{{path_node.todo.title_then|e}} <- {% endfor %}) - - - - +{% if node.todo.has_doneness_in_path %} + -  + -{% else %} - -{% for i in range(indent) %}  {% endfor %} + -{% endif %} -{% if node.seen %}({% endif %}{{node.todo.title_then|e}} {% if node.todo.comment|length > 0 %}[{{node.todo.comment|e}}]{% endif %}{% if node.seen %}){% endif %} +{% for i in range(indent) %}    {% endfor %} + +{% if not node.todo.is_done %}({% endif %}{{node.todo.title_then|e}}{% if not node.todo.is_done %}){% endif %} +{{node.todo.comment|e}} -{% endif %} {% if not node.seen %} {% for child in node.children %} -{{ show_node_done(child, indent+1, path + [node]) }} +{{ show_node_done(child, indent+1) }} {% endfor %} {% endif %} - +{% endif %} {% endmacro %}