feat: cal_exp_duration_sec 还需要更新时间为None2

This commit is contained in:
zty 2024-08-06 18:43:20 +08:00
parent 5461fb5f55
commit 1fe8c7ae76
1 changed files with 3 additions and 0 deletions

View File

@ -70,6 +70,9 @@ def cal_exp_duration_sec(stlogId: str='', all=False, now: datetime=None):
if now is None:
now = timezone.now()
for stlog in stlogs:
if stlog.duration_sec is None and stlog.end_time is not None:
stlog.duration_sec = (stlog.end_time-stlog.start_time).total_seconds()
stlog.save()
is_shutdown_stlog = True
if stlog.is_shutdown is False:
is_shutdown_stlog = False