Skip to content

Commit

Permalink
filter for date range
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashutosh619-sudo committed Nov 17, 2023
1 parent fe138bf commit a3da115
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions apps/fyle/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,17 @@ def get_queryset(self):
tasklog__status='FAILED', workspace_id=self.kwargs['workspace_id']).order_by('-updated_at')

elif state == 'COMPLETE':
return ExpenseGroup.objects.filter(
tasklog__status='COMPLETE', workspace_id=self.kwargs['workspace_id']).order_by('-exported_at')
filters = {
'workspace_id': self.kwargs['workspace_id'],
'tasklog__status': 'COMPLETE'
}

if start_date and end_date:
filters['exported_at__range'] = [start_date, end_date]

if exported_at:
filters['exported_at__gte'] = exported_at
return ExpenseGroup.objects.filter(**filters).order_by('-exported_at')

elif state == 'READY':
return ExpenseGroup.objects.filter(
Expand Down

0 comments on commit a3da115

Please sign in to comment.