auto task switch for work desktop (default)

This commit is contained in:
buenosairesam
2025-05-13 05:00:46 -03:00
parent 7995040c82
commit 7a75d1caae
5 changed files with 26 additions and 7 deletions

View File

@@ -83,6 +83,9 @@ def format_task_line(
def db_to_file_as_is(filepath: str):
"""Write tasks from MongoDB to file exactly as they were read."""
if filepath is None:
filepath = task_file
current_task = state.retrieve("current").get("task")
all_tasks = list(tasks.find())
@@ -141,12 +144,12 @@ def extract(line: str) -> Optional[str]:
return None
def read_and_extract(file_path: str) -> Optional[str]:
def read_and_extract(filepath: str) -> Optional[str]:
"""Read file and update state if current task is found."""
if file_path is None:
file_path = task_file
if filepath is None:
filepath = task_file
with open(file_path, "r") as file:
with open(filepath, "r") as file:
for line in file:
task_id = extract(line)
if task_id: