From 92aa3628cf02ddd39d8495aa4c7747dda64fb7aa Mon Sep 17 00:00:00 2001 From: RujitRaval Date: Tue, 28 Apr 2020 12:35:38 -0400 Subject: [PATCH] Select template based on the region --- bpeng/bis/report.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bpeng/bis/report.py b/bpeng/bis/report.py index 369ecaf..6022fdf 100644 --- a/bpeng/bis/report.py +++ b/bpeng/bis/report.py @@ -45,7 +45,7 @@ def duplicate_slide(pres, index): return dest -def generate_pns_report(building_info, recommendations): +def generate_pns_report(building_info, recommendations, region): """ Generate an PNS Report from dicts @@ -59,8 +59,10 @@ def generate_pns_report(building_info, recommendations): 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_' # Select Template Based on the number of recommendations with a max of 12 recommendations - template_path = os.environ['NON_NYC_PPTX_TEMPLATE_' + str(num_recommendation_slides)] + template_path = os.environ[template_name + str(num_recommendation_slides)] report = TemplateInstantiator(template_path) # Provide template with address, date for title page address = building_info['address'] -- GitLab