修复问题诊断bug

This commit is contained in:
wangxu 2025-10-31 11:49:25 +08:00
parent 5d463c28f1
commit 9453a6df26
2 changed files with 10 additions and 9 deletions

View File

@ -58,6 +58,5 @@ def cross_problems_detail_api():
return query_cross_examine_records_detail(request.json) return query_cross_examine_records_detail(request.json)
if __name__ == '__main__': if __name__ == '__main__':
pass pass

View File

@ -1202,7 +1202,7 @@ def gen_turn_imbalance_problems(road_delay_infos, roads_dir_dict, inroad_static_
} }
] ]
suggestion.extend(item_suggestion) suggestion.extend(item_suggestion)
phase_suggestion = get_flow_phase_detail(src_dir, ['直行', '左转'], cross_phase) phase_suggestion = get_flow_phase_detail(src_dir, [0, 1], cross_phase)
suggestion.extend(phase_suggestion) suggestion.extend(phase_suggestion)
if err_road_dict[src_dir][2]: if err_road_dict[src_dir][2]:
road_num_suggestion.append( road_num_suggestion.append(
@ -1339,7 +1339,7 @@ def gen_phase_problems(nodeid, area_id, crossid, time_range, date_list, min_date
'reason': '路口停车次数徒增或大数据计算方案与录入方案不一致', 'reason': '路口停车次数徒增或大数据计算方案与录入方案不一致',
'suggestions': phase_err_suggestions 'suggestions': phase_err_suggestions
}) })
total = phase_problems_detail['total'] if len(phase_problems_detail) > 0 else 0 total = phase_problems_detail['total'] if phase_problems_detail and len(phase_problems_detail) > 0 else 0
phase_problems['total_num'] = total + phase_err_total_num phase_problems['total_num'] = total + phase_err_total_num
return phase_problems return phase_problems
@ -1388,7 +1388,7 @@ def gen_err_phase_problems(start_hm, max_date, crossid, min_date):
'text': f'{first_date}起在{start_hm}-{end_hm}时段运行的配时方案有异常变动风险,异常等级为' 'text': f'{first_date}起在{start_hm}-{end_hm}时段运行的配时方案有异常变动风险,异常等级为'
}, },
{ {
'color': color_level, 'level_color': color_level,
'text': f',处理状态为', 'text': f',处理状态为',
'final_state': final_state 'final_state': final_state
} }
@ -1578,7 +1578,7 @@ def get_flow_phase_detail(src_dir, turn_type_list, cross_phase):
phase_suggestion = [] phase_suggestion = []
if not cross_phase: if not cross_phase:
return phase_suggestion return phase_suggestion
for item in cross_phase: for item in cross_phase.data:
# 单个元素的含义为一个周计划 # 单个元素的含义为一个周计划
schedule_suggestion = [] schedule_suggestion = []
need_src_flow = {dir_str_dict[src_dir] + int_turn_type2str[item]: 0 for item in turn_type_list} need_src_flow = {dir_str_dict[src_dir] + int_turn_type2str[item]: 0 for item in turn_type_list}
@ -1586,7 +1586,7 @@ def get_flow_phase_detail(src_dir, turn_type_list, cross_phase):
tp_info = item.tps[0] tp_info = item.tps[0]
planid = tp_info.planid planid = tp_info.planid
plan_name = tp_info.plan_name plan_name = tp_info.plan_name
stage_list = tp_info.stages stage_list = tp_info.stage_list
for stage in stage_list: for stage in stage_list:
phases_name = stage.phases_name phases_name = stage.phases_name
phases_name_list = [] phases_name_list = []
@ -1629,7 +1629,9 @@ def get_flow_phase_detail(src_dir, turn_type_list, cross_phase):
def gen_src_dir_phase_detail(max_src_dir, min_src_dir, cross_phase, is_tide=False): def gen_src_dir_phase_detail(max_src_dir, min_src_dir, cross_phase, is_tide=False):
phase_suggestion = [] phase_suggestion = []
for item in cross_phase: if not cross_phase:
return phase_suggestion
for item in cross_phase.data:
# 单个元素的含义为一个周计划 # 单个元素的含义为一个周计划
schedule_suggestion = [] schedule_suggestion = []
schedule_name = item.schedule_name schedule_name = item.schedule_name
@ -1640,7 +1642,7 @@ def gen_src_dir_phase_detail(max_src_dir, min_src_dir, cross_phase, is_tide=Fals
tp_info = item.tps[0] tp_info = item.tps[0]
planid = tp_info.planid planid = tp_info.planid
plan_name = tp_info.plan_name plan_name = tp_info.plan_name
stage_list = tp_info.stages stage_list = tp_info.stage_list
for stage in stage_list: for stage in stage_list:
phases_name = stage.phases_name phases_name = stage.phases_name
src_dir_set = set() src_dir_set = set()
@ -1675,7 +1677,7 @@ def gen_src_dir_phase_detail(max_src_dir, min_src_dir, cross_phase, is_tide=Fals
}) })
need2sug = False need2sug = False
if is_tide: if is_tide:
for item in cross_phase: for item in cross_phase.data:
stages_info = item.tps[0].stages stages_info = item.tps[0].stages
for stage in stages_info: for stage in stages_info:
phases_name = stage.phases_name phases_name = stage.phases_name