diff --git a/bpeng/bis/report.py b/bpeng/bis/report.py index 6022fdf5eb5c6493b5abde4c49f3f24385130dfe..923689374e1db5052ad2ebb5caa4369a20396d86 100644 --- a/bpeng/bis/report.py +++ b/bpeng/bis/report.py @@ -55,14 +55,18 @@ def generate_pns_report(building_info, recommendations, region): Returns a python-pptx presentation object """ - recommendations_slide_index = 2 + recommendations_slide_index = 4 if region == 1 else 2 recs_per_slide = 3 total_recs = len(recommendations) num_recommendation_slides = math.ceil(float(total_recs)/recs_per_slide) - # Get the template name based on region - template_name = 'NON_NYC_PPTX_TEMPLATE_' if region == 2 else 'Milwaukee_PPTX_TEMPLATE_' + # Set Church template as default template_name + template_name = { + 1: 'Church_PPTX_TEMPLATE_', + 2: 'NON_NYC_PPTX_TEMPLATE_', + 3: 'Milwaukee_PPTX_TEMPLATE_' + } # Select Template Based on the number of recommendations with a max of 12 recommendations - template_path = os.environ[template_name + str(num_recommendation_slides)] + template_path = os.environ[template_name[region] + str(num_recommendation_slides)] report = TemplateInstantiator(template_path) # Provide template with address, date for title page address = building_info['address'] @@ -89,6 +93,33 @@ def generate_pns_report(building_info, recommendations, region): addr_sub ]) + # Fill out Building Information & Operational Needs slide for NYC Churches only + if region == 1: + heating_system = Substitution('Heating_system',building_info['heating_system'], font_size=10) + heating_system_age = Substitution('Heating_system_age',building_info['heating_system_age'], font_size=10) + heating_fuel_type = Substitution('Heating_fuel_type',building_info['heating_fuel_type'], font_size=10) + cooling_system = Substitution('Cooling_system',building_info['cooling_system'], font_size=10) + cooling_system_age = Substitution('Cooling_system_age',building_info['cooling_system_age'], font_size=10) + cooling_fuel_type = Substitution('Cooling_fuel_type',building_info['cooling_fuel_type'], font_size=10) + + needs = [] + need_counter = 1 + for building_need in building_info['building_needs']: + need_name = str(need_counter)+'. '+building_need if building_need != " " else " " + needs.append(Substitution('Building_needs_'+str(need_counter), need_name, font_size=10)) + need_counter += 1 + + building_info_slide = report.templateSlideNumber(2) + building_info_slide.add_substitutions([ + heating_system, + heating_system_age, + heating_fuel_type, + cooling_system, + cooling_system_age, + cooling_fuel_type + ]) + building_info_slide.add_substitutions(needs) + # Add Recommendations to Recommedations Slide Template recommendations_inserted = 0