some small fixes
This commit is contained in:
parent
c9e8571a85
commit
5a0c6abad5
@ -1,6 +1,6 @@
|
||||
from datetime import datetime, timedelta
|
||||
from peewee import fn, JOIN
|
||||
from .db import Task, Category, TaskStatus
|
||||
from ..db import Task, Category, TaskStatus
|
||||
|
||||
|
||||
def get_category_summary(num: int = 5) -> list[dict]:
|
||||
@ -101,9 +101,7 @@ def get_recently_active(num: int = 5, category: str | None = None) -> list[dict]
|
||||
List of tasks ordered by last activity (updated_at)
|
||||
"""
|
||||
query = (
|
||||
Task.select(Task, Category.name.alias("category_name"))
|
||||
.join(Category, JOIN.LEFT_OUTER)
|
||||
.where(~Task.deleted)
|
||||
Task.select(Task, Category).join(Category, JOIN.LEFT_OUTER).where(~Task.deleted)
|
||||
)
|
||||
|
||||
if category:
|
||||
@ -117,7 +115,7 @@ def get_recently_active(num: int = 5, category: str | None = None) -> list[dict]
|
||||
"text": task.text,
|
||||
"status": task.status,
|
||||
"type": task.type,
|
||||
"category": task.category_name,
|
||||
"category": task.category.name if task.category else None,
|
||||
"due": task.due,
|
||||
"updated_at": task.updated_at,
|
||||
}
|
||||
@ -172,7 +170,7 @@ def get_due_soon(
|
||||
"text": task.text,
|
||||
"status": task.status,
|
||||
"type": task.type,
|
||||
"category": task.category_name,
|
||||
"category": task.category.name if task.category else None,
|
||||
"due": task.due,
|
||||
"days_until_due": (task.due - now).days if task.due else None,
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import json
|
||||
from datetime import datetime
|
||||
from peewee import fn
|
||||
from .db import db, Task, Category, TaskStatus, SavedSearch
|
||||
from ..db import db, Task, Category, TaskStatus, SavedSearch
|
||||
from peewee import Case, Value
|
||||
|
||||
|
||||
|
@ -27,16 +27,18 @@ class TableColumnConfig:
|
||||
display_name: str,
|
||||
*,
|
||||
default=None,
|
||||
enum=None,
|
||||
enable_editor=False,
|
||||
enum=None,
|
||||
filterable=True,
|
||||
preprocessor=None,
|
||||
):
|
||||
self.field = field
|
||||
self.display_name = display_name
|
||||
self.default = default
|
||||
self.enum = enum
|
||||
self.preprocessor = preprocessor or (lambda x: x)
|
||||
self.enable_editor = enable_editor
|
||||
self.enum = enum
|
||||
self.filterable = filterable
|
||||
self.preprocessor = preprocessor or (lambda x: x)
|
||||
|
||||
|
||||
class TableEditor(App):
|
||||
@ -285,7 +287,7 @@ class TableEditor(App):
|
||||
|
||||
def action_start_filter(self):
|
||||
cconf = self._active_column_config()
|
||||
if cconf.filterable:
|
||||
if not cconf.filterable:
|
||||
return
|
||||
cur_filter_val = self.filters.get(cconf.field) or ""
|
||||
self._show_input("filter", cur_filter_val)
|
||||
|
Loading…
Reference in New Issue
Block a user