mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-02 17:48:36 -04:00
Only include ft_billing data for current financial year
Test get_live_services_data endpoint Expand dao_fetch_live_services_data test with more ft_billing records
This commit is contained in:
@@ -7,8 +7,8 @@ import pytz
|
||||
def get_months_for_financial_year(year):
|
||||
return [
|
||||
convert_bst_to_utc(month) for month in (
|
||||
get_months_for_year(4, 13, year) +
|
||||
get_months_for_year(1, 4, year + 1)
|
||||
get_months_for_year(4, 13, year)
|
||||
+ get_months_for_year(1, 4, year + 1)
|
||||
)
|
||||
if convert_bst_to_utc(month) < datetime.now()
|
||||
]
|
||||
@@ -22,6 +22,14 @@ def get_financial_year(year):
|
||||
return get_april_fools(year), get_april_fools(year + 1) - timedelta(microseconds=1)
|
||||
|
||||
|
||||
def get_current_financial_year():
|
||||
now = datetime.utcnow()
|
||||
current_month = int(now.strftime('%-m'))
|
||||
current_year = int(now.strftime('%Y'))
|
||||
year = current_year if current_month > 3 else current_year - 1
|
||||
return get_financial_year(year)
|
||||
|
||||
|
||||
def get_april_fools(year):
|
||||
"""
|
||||
This function converts the start of the financial year April 1, 00:00 as BST (British Standard Time) to UTC,
|
||||
|
||||
Reference in New Issue
Block a user