feat: translate_eval_formula 打印报错信息

This commit is contained in:
caoqianming 2025-12-03 16:16:58 +08:00
parent 7e09b872cf
commit 75b2a420b7
1 changed files with 5 additions and 1 deletions

View File

@ -35,7 +35,11 @@ def translate_eval_formula(exp_str: str, year: int, month: int, day: int, hour:
for match in matches: for match in matches:
mpst = MpointStat.objects.filter(mpoint__code=match, type="hour", year=year, month=month, day=day, hour=hour).first() mpst = MpointStat.objects.filter(mpoint__code=match, type="hour", year=year, month=month, day=day, hour=hour).first()
if mpst is None: if mpst is None:
try:
mpoint = Mpoint.objects.get(code=match) mpoint = Mpoint.objects.get(code=match)
except Exception as e:
myLogger.error(f"找不到该测点: exp_str: {exp_str} code: {match} {e}")
raise
mpst, _ = MpointStat.objects.get_or_create(mpoint=mpoint, type="hour", year=year, month=month, day=day, hour=hour, defaults={"val": 0}) 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值") myLogger.error(f"找不到该测点的时间线数据: {match}, {year}, {month}, {day}, {hour}, 赋予0值")
if mpst: if mpst: