Fix recurring task duplication bug

Prevent process_recurring_tasks from creating duplicate tasks for dates that already have completed instances. Previously only checked for pending tasks, causing old completed recurring tasks to reappear as pending when subsequent instances went overdue.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Keith Smith
2026-02-03 16:52:06 -07:00
co-authored by Claude Sonnet 4.5
parent cdcae378b7
commit c8ffa615f0
+2 -2
View File
@@ -161,12 +161,12 @@ def process_recurring_tasks():
next_due_date = task.calculate_next_due_date()
if next_due_date:
# Check if we already created this recurrence
# Check for any task (pending OR completed) to avoid duplicates
existing = Task.objects.filter(
user=task.user,
title=task.title,
due_date=next_due_date,
recurrence=task.recurrence,
status='pending'
recurrence=task.recurrence
).exists()
if not existing: