Make todo manager map todos to ids
This commit is contained in:
@@ -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:
|
||||||
|
|||||||
Reference in New Issue
Block a user