improve how we find monthly bill in a month, dont use exact date just use yy-mm, also fix BUG where kayo used estimate in jan to project for the next 5years, rather than real bill in feb (all in the future) to estimate
This commit is contained in:
1
BUGS
1
BUGS
@@ -1,4 +1,3 @@
|
||||
* kayo is using wrong bill to extend - there is a future bill in the monthly and that is not being used...
|
||||
* added an electricity bill by accident for 2018, that kills lots :(
|
||||
- something to do with missing year of data in quarterly bills - still an issue
|
||||
|
||||
|
||||
7
bills.py
7
bills.py
@@ -110,6 +110,10 @@ def find_previous_bill( bill_type, bill_info, bill_date ):
|
||||
# okay, we have the previous billing year, and we wanted one for a year in the future,
|
||||
# just return the last one in this year as its the most recent
|
||||
if wanted_year > yr:
|
||||
# small chance of future bills having estimates and reals (kayo did this)
|
||||
for tmp in bill_info[bill_type]['year'][yr]:
|
||||
if tmp['estimated'] == 0:
|
||||
return tmp
|
||||
return bill_info[bill_type]['year'][yr][0]
|
||||
else:
|
||||
# lets go through the newest to oldest of these bills
|
||||
@@ -219,12 +223,13 @@ def add_missing_monthly_bills_in_yr( bill_type, bill_info, yr ):
|
||||
for i in range( start_m+1, 13 ):
|
||||
bill_found=False
|
||||
new_date = f'{yr}-{i:02d}-{dd}'
|
||||
new_date_yymm=f'{yr}-{i:02d}'
|
||||
if yr in bill_info[bill_type]['year']:
|
||||
for b in bill_info[bill_type]['year'][yr]:
|
||||
# this bill exists, skip adding it (this occurs when called to
|
||||
# add bills as there are < 12 bills in first_year, BUT, we
|
||||
# don't fill before first_bill so the < 12 ALWAYS triggers
|
||||
if str(b['bill_date']) == new_date:
|
||||
if new_date_yymm in str(b['bill_date']):
|
||||
bill_found=True
|
||||
break
|
||||
if not bill_found:
|
||||
|
||||
Reference in New Issue
Block a user