Skip to content

Commit 7bbe6b2

Browse files
Changed the method for displaying task completion status
- Completed tasks are now marked with the symbol '[✓]', and uncompleted tasks with '[✗]', making the status more intuitive. - Added the ability to customize symbols via method parameters.
1 parent f5f8b74 commit 7bbe6b2

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

utils/app_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def show_task_list(self):
114114
self._printer.print_center(f'Task list ({self._todo_manager.count}):')
115115
if task_list:
116116
for n, task in enumerate(task_list, 1):
117-
print(f'{n}. {task.title}')
117+
print(f'{n}. {task.title} {task.get_completed_status_text}')
118118
else:
119119
print('Tasks not found...')
120120
print('0. Back')

utils/task_managers.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ def from_dict(cls, data):
4747
task.updated_at = data['updated_at']
4848
return task
4949

50+
@property
51+
def get_completed_status_text(self, completed_symbol='[✓]', not_completed_symbol='[✗]'):
52+
return completed_symbol if self.completed else not_completed_symbol
53+
5054

5155
class TaskManagerJSON:
5256
def __init__(self, filename='todo.json'):

0 commit comments

Comments
 (0)