fix: cal_enstat2 bug

This commit is contained in:
caoqianming 2023-08-23 08:48:37 +08:00
parent 50714225e5
commit 18942d57c9
1 changed files with 7 additions and 7 deletions

View File

@ -469,14 +469,14 @@ def get_total_hour_now_and_shut_hour(enstat: EnStat):
@shared_task(base=CustomTask)
def cal_enstat2(type: str, year_s: int, month_s: int, day_s: int, cascade=True):
if type == 'day_s':
cal_enstat2('day_s', year_s, month_s, day_s, False)
if cascade:
if cascade:
if type == 'day_s':
cal_enstat2('day_s', year_s, month_s, day_s, False)
cal_enstat2('month_s', year_s, month_s, day_s, False)
elif type == 'month_s':
cal_enstat2('month_s', year_s, month_s, day_s, False)
else:
return
elif type == 'month_s':
cal_enstat2('month_s', year_s, month_s, day_s, False)
else:
return
if type == 'month_s':
enstat2, _ = EnStat2.objects.get_or_create(type="month_s", year_s=year_s, month_s=month_s, defaults={'year_s': year_s, 'month_s': month_s, 'type': 'month_s'})
elif type == 'day_s':