fix: except ZeroDivisionError

This commit is contained in:
caoqianming 2023-08-03 10:37:03 +08:00
parent a609b1db94
commit 60ac9e6ac2
1 changed files with 5 additions and 2 deletions

View File

@ -404,8 +404,11 @@ def cal_enstat(type, sflogId, mgroupId, year, month, day, hour, year_s, month_s,
if type != 'hour_s' and 'run_hour' in this_cal_attrs:
enstat.total_hour_now, enstat.shut_hour = get_total_hour_now_and_shut_hour(enstat)
enstat.run_hour = enstat.total_hour_now - enstat.shut_hour
try:
enstat.run_rate = (enstat.run_hour / enstat.total_hour_now)*100
enstat.production_hour = enstat.total_production / enstat.total_hour_now
except ZeroDivisionError:
pass
enstat.save()
enstat.save()