diff --git a/.gitignore b/.gitignore index 62ee715..40faf22 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ dm.out dm.err sample_task_file dmfnt +def +config.json diff --git a/dmapp/dmcore/config.json b/dmapp/dmcore/config.json.template similarity index 61% rename from dmapp/dmcore/config.json rename to dmapp/dmcore/config.json.template index 1f45ba2..b5731b2 100644 --- a/dmapp/dmcore/config.json +++ b/dmapp/dmcore/config.json.template @@ -1,9 +1,9 @@ { "work_desktop_tasks": { - "2": null, - "5": null, - "6": null, - "7": null + "2": "686a7bd2", + "5": "ac6b4a54", + "6": "ba63b454", + "7": "ffbe198e" }, "timezone": "America/Argentina/Buenos_Aires", "task_file": "/home/mariano/LETRAS/adm/task/main" diff --git a/dmapp/dmcore/main.py b/dmapp/dmcore/main.py index 9cc4361..4a2393c 100644 --- a/dmapp/dmcore/main.py +++ b/dmapp/dmcore/main.py @@ -40,7 +40,7 @@ def now(): def handle_task_file_changes(current_task): - """Check if task file changed and update task if needed""" + """Check if task file changed and update task if needed. Returns (new_task, file_changed)""" current_mtime = state.retrieve("current").get("filetime") file_mtime = task.get_file_mtime(None) @@ -52,7 +52,9 @@ def handle_task_file_changes(current_task): state.save("current", task=task_id) current_task = task_id - return current_task + return current_task, True # File changed + + return current_task, False # No change def update_workspace_state(): @@ -120,7 +122,7 @@ def desktop(workspace_index): task.read_and_extract(None) - +task.file_to_db(None) current_workspace = active_workspace() current_task = state.retrieve("current").get("task") @@ -143,14 +145,15 @@ while True: work_desktop_tasks = state.retrieve_desktop_state() # Handle task file changes - current_task = handle_task_file_changes(current_task) + current_task, file_changed = handle_task_file_changes(current_task) # Update current task and workspace current_task = state.retrieve("current").get("task") current_workspace = update_workspace_state() - # Enforce desktop task assignments - current_task = enforce_desktop_task(current_workspace, work_desktop_tasks, current_task) + # Enforce desktop task assignments (but skip if file just changed - user's manual change takes priority) + if not file_changed: + current_task = enforce_desktop_task(current_workspace, work_desktop_tasks, current_task) # Track workspace switches last_switch_time = track_workspace_switch(current_workspace, current_task, last_switch_time)