Implement recurring tasks functionality

Adds automatic creation of next task instance when recurring tasks are completed.

- Add calculate_next_due_date() and create_next_recurrence() methods to Task model
- Update task completion handlers in views and sync API to create next recurrence
- Add hourly Celery task to process any missed recurring tasks
- Support daily, weekly, biweekly, monthly, yearly recurrence patterns
- Respect recurrence_end_date limits

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Keith Smith
2026-01-04 10:00:34 -07:00
co-authored by Claude Sonnet 4.5
parent c51fd846a2
commit 1d6b07bfed
5 changed files with 145 additions and 0 deletions
+7
View File
@@ -291,6 +291,9 @@ def process_time_entry_changes(user, entry_changes, last_sync_at):
def update_task_from_data(task, data):
"""Update a task from sync data."""
# Track old status to detect completion
old_status = task.status
task.title = data.get('title', task.title)
task.description = data.get('description', task.description)
task.status = data.get('status', task.status)
@@ -302,6 +305,10 @@ def update_task_from_data(task, data):
task.recurrence_rule = data.get('recurrence_rule', task.recurrence_rule)
task.sort_order = data.get('sort_order', task.sort_order)
# Create next recurrence if task is being marked as completed
if old_status != 'completed' and task.status == 'completed' and task.recurrence != 'none':
task.create_next_recurrence()
task.save()
# Handle tags