feat: 优化cal_exp_duration_sec
This commit is contained in:
parent
aadb9fdf2c
commit
6ecf61706a
|
@ -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()
|
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()
|
SfLogExp.objects.filter(stlog=stlog).exclude(sflog__in=sf_qs).delete()
|
||||||
for ind, sflog in enumerate(sf_qs):
|
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={
|
sflogexp, _ = SfLogExp.objects.get_or_create(stlog=stlog, sflog=sflog, defaults={
|
||||||
'stlog': stlog, 'sflog': sflog})
|
'stlog': stlog, 'sflog': sflog})
|
||||||
# 计算duration
|
# 计算duration
|
||||||
|
|
Loading…
Reference in New Issue