fix updates
This commit is contained in:
parent
426c91ae23
commit
b8a86eca16
@ -41,7 +41,6 @@ def update_task(
|
|||||||
with db.atomic():
|
with db.atomic():
|
||||||
if category := kwargs.pop("category", None):
|
if category := kwargs.pop("category", None):
|
||||||
kwargs["category_id"] = category_lookup(category)
|
kwargs["category_id"] = category_lookup(category)
|
||||||
task = Task.get_by_id(task_id)
|
|
||||||
query = Task.update(kwargs).where(Task.id == task_id)
|
query = Task.update(kwargs).where(Task.id == task_id)
|
||||||
query.execute()
|
query.execute()
|
||||||
task = Task.get_by_id(task_id)
|
task = Task.get_by_id(task_id)
|
||||||
@ -108,7 +107,16 @@ def get_categories() -> list[Category]:
|
|||||||
def save_view(name: str, *, filters: dict, sort_string: str) -> SavedSearch:
|
def save_view(name: str, *, filters: dict, sort_string: str) -> SavedSearch:
|
||||||
filters_json = json.dumps(filters)
|
filters_json = json.dumps(filters)
|
||||||
|
|
||||||
return SavedSearch.create(name=name, filters=filters_json, sort_string=sort_string)
|
with db.atomic():
|
||||||
|
if SavedSearch.select(SavedSearch.name == name).exists():
|
||||||
|
query = SavedSearch.update(
|
||||||
|
filters=filters_json, sort_string=sort_string
|
||||||
|
).where(SavedSearch.name == name)
|
||||||
|
query.execute()
|
||||||
|
else:
|
||||||
|
return SavedSearch.create(
|
||||||
|
name=name, filters=filters_json, sort_string=sort_string
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_saved_view_names() -> list[str]:
|
def get_saved_view_names() -> list[str]:
|
||||||
|
Loading…
Reference in New Issue
Block a user