This commit is contained in:
caoqianming 2025-01-16 11:30:40 +08:00
commit 7efdc2c316
1 changed files with 3 additions and 1 deletions

View File

@ -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: