Skip to content

Commit

Permalink
Tweak finance dashboard to ignore 'non-rigs' when counting 'total eve…
Browse files Browse the repository at this point in the history
…nts'

You can't invoice for a 'non-rig' after all.
  • Loading branch information
FreneticScribbler committed Oct 30, 2024
1 parent 9f910af commit 3afa4de
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions RIGS/views/finance.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@ def get_context_data(self, **kwargs):
time_filter = 'all'

if time_filter == 'all':
context['events'] = models.Event.objects.all()
context['events'] = models.Event.objects.filter(is_rig=True)
context['invoices'] = models.Invoice.objects.all()
context['payments'] = models.Payment.objects.all()
elif time_filter == 'year':
context['events'] = models.Event.objects.filter(start_date__gte=datetime.date.today() - datetime.timedelta(days=365))
context['events'] = models.Event.objects.filter(is_rig=True, start_date__gte=datetime.date.today() - datetime.timedelta(days=365))
context['invoices'] = models.Invoice.objects.filter(invoice_date__gte=datetime.date.today() - datetime.timedelta(days=365))
context['payments'] = models.Payment.objects.filter(date__gte=datetime.date.today() - datetime.timedelta(days=365))
elif time_filter == 'month':
context['events'] = models.Event.objects.filter(start_date__gte=datetime.date.today() - datetime.timedelta(days=30))
context['events'] = models.Event.objects.filter(is_rig=True, start_date__gte=datetime.date.today() - datetime.timedelta(days=30))
context['invoices'] = models.Invoice.objects.filter(invoice_date__gte=datetime.date.today() - datetime.timedelta(days=30))
context['payments'] = models.Payment.objects.filter(date__gte=datetime.date.today() - datetime.timedelta(days=30))
elif time_filter == 'week':
context['events'] = models.Event.objects.filter(start_date__gte=datetime.date.today() - datetime.timedelta(days=7))
context['events'] = models.Event.objects.filter(is_rig=True, start_date__gte=datetime.date.today() - datetime.timedelta(days=7))
context['invoices'] = models.Invoice.objects.filter(invoice_date__gte=datetime.date.today() - datetime.timedelta(days=7))
context['payments'] = models.Payment.objects.filter(date__gte=datetime.date.today() - datetime.timedelta(days=7))

Expand Down

0 comments on commit 3afa4de

Please sign in to comment.