fixed divide by zero issues in equipmentsaving

pull/10/MERGE
13621160019@163.com 2021-03-07 11:08:36 +08:00
parent 57a4bf377b
commit cd6237d57c
1 changed files with 6 additions and 6 deletions

View File

@ -329,9 +329,9 @@ def generate_excel(report,
ws['D' + str(current_row_number)].font = name_font
ws['D' + str(current_row_number)].alignment = c_c_alignment
ws['D' + str(current_row_number)].border = f_border
ws['D' + str(current_row_number)] = \
str(round(reporting_period_data['subtotals_in_kgce_saving'][i] /
subtotals_in_kgce_saving_sum * 100, 2)) + '%'
ws['D' + str(current_row_number)] = str(round(reporting_period_data['subtotals_in_kgce_saving'][i] /
subtotals_in_kgce_saving_sum * 100, 2)) + '%' \
if subtotals_in_kgce_saving_sum > 0 else '-'
current_row_number += 1
@ -398,9 +398,9 @@ def generate_excel(report,
ws['D' + str(current_row_number)].font = name_font
ws['D' + str(current_row_number)].alignment = c_c_alignment
ws['D' + str(current_row_number)].border = f_border
ws['D' + str(current_row_number)] = \
str(round(reporting_period_data['subtotals_in_kgco2e_saving'][i] /
subtotals_in_kgco2e_saving_sum * 100, 2)) + '%'
ws['D' + str(current_row_number)] = str(round(reporting_period_data['subtotals_in_kgco2e_saving'][i] /
subtotals_in_kgco2e_saving_sum * 100, 2)) + '%' \
if subtotals_in_kgco2e_saving_sum > 0 else '-'
current_row_number += 1