Merge pull request #122 from chablino/fix-S07

Fix: Sort task JSON files numerically instead of lexicographically
This commit is contained in:
Xinlu Lai
2026-03-29 23:06:31 +08:00
committed by GitHub

View File

@@ -112,7 +112,11 @@ class TaskManager:
def list_all(self) -> str:
tasks = []
for f in sorted(self.dir.glob("task_*.json")):
files = sorted(
self.dir.glob("task_*.json"),
key=lambda f: int(f.stem.split("_")[1])
)
for f in files:
tasks.append(json.loads(f.read_text()))
if not tasks:
return "No tasks."