Make todo manager map todos to ids

This commit is contained in:
2025-11-30 22:13:01 -05:00
parent 5c5a20a159
commit 3411d1886a

View File

@@ -29,11 +29,16 @@ class TodoManager:
def close_todo_file(self): def close_todo_file(self):
self.file.close() self.file.close()
def get_todos(self) -> list[Todo]: def get_todos(self) -> dict[str, Todo]:
if not self.does_todo_file_exist(): if not self.does_todo_file_exist():
return [] return {}
return self.read_todos() todos = self.read_todos()
out = {}
for t in todos:
out[t.lid] = t
return out
def write_todos(self, todos: list[Todo]): def write_todos(self, todos: list[Todo]):
for t in todos: for t in todos: