From 152b0b5a3a5227001557b819462ba310cc899f24 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Fri, 6 Dec 2024 17:24:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=BF=BD=E7=95=A510s=E5=86=85=E7=9A=84?= =?UTF-8?q?=E5=81=9C=E6=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wpm/tasks.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/wpm/tasks.py b/apps/wpm/tasks.py index 28fa85a0..f0968663 100644 --- a/apps/wpm/tasks.py +++ b/apps/wpm/tasks.py @@ -73,8 +73,12 @@ def cal_exp_duration_sec(stlogId: str='', all=False, now: datetime=None): now = timezone.now() for stlog in stlogs: if stlog.duration_sec is None and stlog.end_time: - stlog.duration_sec = (stlog.end_time-stlog.start_time).total_seconds() - stlog.save() + duration_sec = (stlog.end_time-stlog.start_time).total_seconds() + if duration_sec <= 10: + stlog.delete() + else: + stlog.duration_sec = duration_sec + stlog.save() is_shutdown_stlog = True if stlog.is_shutdown is False: is_shutdown_stlog = False