fix: cal_shut_hour bug
This commit is contained in:
parent
e4c49918ae
commit
4fa33a7252
|
@ -79,11 +79,12 @@ def cal_shut_hour(stlogId: str):
|
|||
sflogexp, _ = SfLogExp.objects.get_or_create(stlog=stlog, sflog=sflog, defaults={'stlog': stlog, 'sflog': sflog, 'is_current_down': is_current_down, 'title': '停机'})
|
||||
# 计算duration
|
||||
sf_end, sf_start = sflog.end_time, sflog.start_time
|
||||
duration_item = min(sf_end, st_end) - min(sf_start, st_start)
|
||||
if duration_item < 0:
|
||||
duration_item_delta = min(sf_end, st_end) - min(sf_start, st_start)
|
||||
total_seconds = duration_item_delta.total_seconds()
|
||||
if total_seconds < 0:
|
||||
duration_item = 0
|
||||
else:
|
||||
duration_item = duration_item.total_seconds()/3600
|
||||
duration_item = total_seconds/3600
|
||||
sflogexp.duration = duration_item
|
||||
sflogexp.save()
|
||||
# 计算每班的总停机时间
|
||||
|
|
Loading…
Reference in New Issue