feat: enm/service 修改传入公式,校正计算测点
This commit is contained in:
parent
0dbbc9beb2
commit
9c3cf5a534
|
@ -39,7 +39,9 @@ def translate_eval_formula(exp_str: str, year: int, month: int, day: int, hour:
|
|||
mpst, _ = MpointStat.objects.get_or_create(mpoint=mpoint, type="hour", year=year, month=month, day=day, hour=hour, defaults={"val": 0})
|
||||
myLogger.error(f"找不到该测点的时间线数据: {match}, {year}, {month}, {day}, {hour}, 赋予0值")
|
||||
if mpst:
|
||||
exp_str2 = exp_str2.replace(f"{{{match}}}", str(mpst.val))
|
||||
# exp_str2 = exp_str2.replace(f"{{{match}}}", str(mpst.val))
|
||||
# 为了校正计算测点
|
||||
exp_str2 = exp_str2.replace(f"{{{match}}}", str(mpst.val if mpst.val_correct is None else mpst.val_correct))
|
||||
try:
|
||||
rval = eval(exp_str2)
|
||||
except Exception as e:
|
||||
|
|
Loading…
Reference in New Issue