Skip to content

Commit

Permalink
Merge pull request #818 from samuelveigarangel/improve-task-delete-un…
Browse files Browse the repository at this point in the history
…expected-events

Melhora Task delete_unexpected_events
  • Loading branch information
samuelveigarangel authored Jul 15, 2024
2 parents 746856a + 9ff8beb commit ff9eb71
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tracker/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ def delete_unexpected_events(self, exception_type, start_date=None, end_date=Non
Delete UnexpectedEvent records based on exception type and optional date range.
"""

if exception_type == '__all__':
UnexpectedEvent.objects.all().delete()
return
filters = {}
if exception_type:
filters['exception_type__icontains'] = exception_type

filters = {'exception_type__icontains': exception_type}
if start_date:
start_date = datetime.fromisoformat(start_date)
filters['created__gte'] = start_date
Expand Down

0 comments on commit ff9eb71

Please sign in to comment.