diff --git a/apps/enm/services.py b/apps/enm/services.py index abf04b35..c5bf7711 100644 --- a/apps/enm/services.py +++ b/apps/enm/services.py @@ -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: