new view, gnome extension
This commit is contained in:
@@ -20,8 +20,11 @@ def parse_line(line: str) -> tuple[Optional[str], Optional[str]]:
|
||||
parts = line.split("|")
|
||||
if len(parts) > 1:
|
||||
task_name = parts[0].strip()
|
||||
task_id = parts[1].split()[0].strip()
|
||||
return task_name, task_id
|
||||
id_parts = parts[1].split()
|
||||
if id_parts:
|
||||
task_id = id_parts[0].strip()
|
||||
return task_name, task_id
|
||||
return task_name, None
|
||||
|
||||
return parts[0].strip(), None
|
||||
|
||||
@@ -32,7 +35,8 @@ def file_to_db(filepath: str):
|
||||
filepath = task_file
|
||||
|
||||
current_path = []
|
||||
tasks.delete_many({})
|
||||
# Only delete non-historic tasks
|
||||
tasks.delete_many({"historic": {"$ne": True}})
|
||||
seen_paths = set()
|
||||
|
||||
with open(filepath, "r") as f:
|
||||
@@ -54,8 +58,8 @@ def file_to_db(filepath: str):
|
||||
|
||||
if task_id:
|
||||
tasks.update_one(
|
||||
{"_id": task_id},
|
||||
{"$set": {"path": full_path, "task_id": task_id}},
|
||||
{"task_id": task_id},
|
||||
{"$set": {"path": full_path, "task_id": task_id, "historic": False}},
|
||||
upsert=True,
|
||||
)
|
||||
elif full_path not in seen_paths:
|
||||
|
||||
Reference in New Issue
Block a user