From 6ecf61706ac7e69c3f0af1d53fb460a8e1835865 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Wed, 11 Dec 2024 18:16:03 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96cal=5Fexp=5Fduration?= =?UTF-8?q?=5Fsec?= 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 f0968663..0ef81c59 100644 --- a/apps/wpm/tasks.py +++ b/apps/wpm/tasks.py @@ -94,6 +94,9 @@ def cal_exp_duration_sec(stlogId: str='', all=False, now: datetime=None): end_time__lte=st_end) | sf_qs.filter(start_time__lte=st_start, end_time__gte=st_end)).order_by('start_time').distinct() SfLogExp.objects.filter(stlog=stlog).exclude(sflog__in=sf_qs).delete() for ind, sflog in enumerate(sf_qs): + if ind == 0: + stlog.sflog = sflog + stlog.save() sflogexp, _ = SfLogExp.objects.get_or_create(stlog=stlog, sflog=sflog, defaults={ 'stlog': stlog, 'sflog': sflog}) # 计算duration