add task respects filters
This commit is contained in:
parent
7b957dd2c0
commit
fb23b5161f
@ -29,6 +29,7 @@ from .utils import (
|
||||
get_colored_date,
|
||||
)
|
||||
|
||||
DEFAULT_CATEGORY = "main"
|
||||
COLUMNS = ("ID", "Task", "Status", "Type", "Due", "Category")
|
||||
column_to_field = {
|
||||
0: "ID",
|
||||
@ -231,11 +232,16 @@ class TT(App):
|
||||
self.refresh_tasks()
|
||||
|
||||
def action_add_task(self):
|
||||
# if filtering on type, status, or category
|
||||
# the new task should use the selected value
|
||||
category = self.filters.get("category", DEFAULT_CATEGORY)
|
||||
status = self.filters.get("status", TaskStatus.ZERO.value).split(",")[0]
|
||||
type_ = self.filters.get("type", "").split(",")[0]
|
||||
new_task = add_task(
|
||||
text="New Task",
|
||||
type="",
|
||||
status=TaskStatus.ZERO.value,
|
||||
category="main",
|
||||
type=type_,
|
||||
status=status,
|
||||
category=category,
|
||||
)
|
||||
self.refresh_tasks(restore_cursor=False)
|
||||
self.move_cursor_to_task(new_task.id)
|
||||
|
Loading…
Reference in New Issue
Block a user