fix: cal_enstat2 bug
This commit is contained in:
parent
50714225e5
commit
18942d57c9
|
|
@ -469,14 +469,14 @@ def get_total_hour_now_and_shut_hour(enstat: EnStat):
|
||||||
|
|
||||||
@shared_task(base=CustomTask)
|
@shared_task(base=CustomTask)
|
||||||
def cal_enstat2(type: str, year_s: int, month_s: int, day_s: int, cascade=True):
|
def cal_enstat2(type: str, year_s: int, month_s: int, day_s: int, cascade=True):
|
||||||
if type == 'day_s':
|
if cascade:
|
||||||
cal_enstat2('day_s', year_s, month_s, day_s, False)
|
if type == 'day_s':
|
||||||
if cascade:
|
cal_enstat2('day_s', year_s, month_s, day_s, False)
|
||||||
cal_enstat2('month_s', year_s, month_s, day_s, False)
|
cal_enstat2('month_s', year_s, month_s, day_s, False)
|
||||||
elif type == 'month_s':
|
elif type == 'month_s':
|
||||||
cal_enstat2('month_s', year_s, month_s, day_s, False)
|
cal_enstat2('month_s', year_s, month_s, day_s, False)
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
if type == 'month_s':
|
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'})
|
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':
|
elif type == 'day_s':
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue