Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sl/SL_Menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ def render_icon_button_css():
if 'tracker' not in st.session_state:
st.session_state.tracker = TimeTracker()
st.session_state.tracker.initialize_dependencies()
st.session_state.tracker.set_today_flag_for_due_tasks() # Set 'today' flag for tasks due today

if 'menu' not in st.session_state:
st.session_state.menu = 'main'
Expand Down
22 changes: 22 additions & 0 deletions tt/TimeTracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,28 @@ def cleanup_overdue_today_tasks(self):
self._save_data()
return changed

def set_today_flag_for_due_tasks(self):
"""
Sets the 'today' flag (⭐) for tasks that have today's date as their due date
and are not yet marked as 'today'.

:return: True if any task was updated and saved.
:rtype: bool
"""
today_str = date.today().isoformat()
changed = False
for project in self.data.get("projects", []):
for task in project.get("tasks", []):
# Only consider open tasks
if task.get('status') == self.STATUS_OPEN:
# If due date is today and 'today' flag is not set
if task.get('due_date') == today_str and not task.get('today'):
task['today'] = True
changed = True
if changed:
self._save_data()
return changed

def delete_task(self, main_project_name, task_name, task_id=None):
"""
Deletes a task from a main project.
Expand Down
Loading