From 1fe8c7ae76721e11cbdd9c32d83ed017cf766b77 Mon Sep 17 00:00:00 2001 From: zty Date: Tue, 6 Aug 2024 18:43:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20cal=5Fexp=5Fduration=5Fsec=20=E8=BF=98?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E6=9B=B4=E6=96=B0=E6=97=B6=E9=97=B4=E4=B8=BA?= =?UTF-8?q?None2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wpm/tasks.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/wpm/tasks.py b/apps/wpm/tasks.py index f5e6b313..6dafc52d 100644 --- a/apps/wpm/tasks.py +++ b/apps/wpm/tasks.py @@ -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