1
0

undo commit 669181239d, hide empty (deleted) tasks in ls function instead

This commit is contained in:
Akbar Rahman 2021-02-27 15:14:09 +00:00
parent 5892e80e2e
commit c08281b83a
2 changed files with 3 additions and 2 deletions

View File

@ -30,6 +30,9 @@ def ls(update, context):
tasks = db.get_all_user_tasks(update.effective_user) tasks = db.get_all_user_tasks(update.effective_user)
r = "" r = ""
for task in tasks: for task in tasks:
if str(task) == "":
continue
if task.done is ('done' in update.message['text']) or ('all' in update.message['text']): if task.done is ('done' in update.message['text']) or ('all' in update.message['text']):
r+= f"{task.id} {str(task)}" r+= f"{task.id} {str(task)}"
r+= '\n' r+= '\n'

View File

@ -34,8 +34,6 @@ def get_all_user_tasks(user) -> "list of pydo.Task":
r = [] r = []
for id, task_str in enumerate(task_list): for id, task_str in enumerate(task_list):
if task_str == '':
continue
task = pydo.Task(task_str) task = pydo.Task(task_str)
task.id = id task.id = id
r.append(task) r.append(task)