add two_weeks filter to dashbaord job graph api view

This commit is contained in:
John Mitchell 2020-10-15 15:34:23 -04:00
parent f3ac57e3b6
commit 782e8d5875
2 changed files with 4 additions and 1 deletions

View File

@ -8,7 +8,7 @@ The `period` of the data can be adjusted with:
?period=month
Where `month` can be replaced with `week`, or `day`. `month` is the default.
Where `month` can be replaced with `week`, `two_weeks`, or `day`. `month` is the default.
The type of job can be filtered with:

View File

@ -316,6 +316,9 @@ class DashboardJobsGraphView(APIView):
if period == 'month':
end_date = start_date - dateutil.relativedelta.relativedelta(months=1)
interval = 'days'
elif period == 'two_weeks':
end_date = start_date - dateutil.relativedelta.relativedelta(weeks=2)
interval = 'days'
elif period == 'week':
end_date = start_date - dateutil.relativedelta.relativedelta(weeks=1)
interval = 'days'