diff --git a/bills.py b/bills.py index 79fea32..efefdf7 100644 --- a/bills.py +++ b/bills.py @@ -447,7 +447,7 @@ def derive_ann_growth( bill_type, bill_info ): else: # 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 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 set_bill_type_growth( bill_type, 0, 0, 0, simple_growth ) else: