bug fixed where we had a bill deleted it then growth was still trying to be calc when it no longer could

This commit is contained in:
2025-08-31 10:39:58 +10:00
parent 392daa1deb
commit 17f2534056

View File

@@ -447,7 +447,7 @@ def derive_ann_growth( bill_type, bill_info ):
else: else:
# okay use last - first / years to get a simple_growth, just need bills from different years # okay use last - first / years to get a simple_growth, just need bills from different years
# if there are totals for them (may not be set with monthly and < 12 bills in 1st year) # if there are totals for them (may not be set with monthly and < 12 bills in 1st year)
if bill_info[bill_type]['first_bill_year'] != bill_info[bill_type]['last_real_bill_year'] and bill_info[bill_type]['first_bill_year'] in total and bill_info[bill_type]['last_real_bill_year'] in total: if 'last_real_bill_year' in bill_info[bill_type] and bill_info[bill_type]['first_bill_year'] != bill_info[bill_type]['last_real_bill_year'] and bill_info[bill_type]['first_bill_year'] in total and bill_info[bill_type]['last_real_bill_year'] in total:
simple_growth=( ((total[bill_info[bill_type]['last_real_bill_year']]-total[bill_info[bill_type]['first_bill_year']])/(bill_info[bill_type]['last_real_bill_year']-bill_info[bill_type]['first_bill_year'])) / total[bill_info[bill_type]['first_bill_year']] )*100.0 simple_growth=( ((total[bill_info[bill_type]['last_real_bill_year']]-total[bill_info[bill_type]['first_bill_year']])/(bill_info[bill_type]['last_real_bill_year']-bill_info[bill_type]['first_bill_year'])) / total[bill_info[bill_type]['first_bill_year']] )*100.0
set_bill_type_growth( bill_type, 0, 0, 0, simple_growth ) set_bill_type_growth( bill_type, 0, 0, 0, simple_growth )
else: else: