diff --git a/app/cross_eva_views.py b/app/cross_eva_views.py index 5479056..4daa9ef 100644 --- a/app/cross_eva_views.py +++ b/app/cross_eva_views.py @@ -58,6 +58,5 @@ def cross_problems_detail_api(): return query_cross_examine_records_detail(request.json) - if __name__ == '__main__': pass \ No newline at end of file diff --git a/app/eva_common.py b/app/eva_common.py index 9a4bf48..808d0df 100644 --- a/app/eva_common.py +++ b/app/eva_common.py @@ -1202,7 +1202,7 @@ def gen_turn_imbalance_problems(road_delay_infos, roads_dir_dict, inroad_static_ } ] 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) if err_road_dict[src_dir][2]: road_num_suggestion.append( @@ -1339,7 +1339,7 @@ def gen_phase_problems(nodeid, area_id, crossid, time_range, date_list, min_date 'reason': '路口停车次数徒增或大数据计算方案与录入方案不一致', '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 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}时段运行的配时方案有异常变动风险,异常等级为' }, { - 'color': color_level, + 'level_color': color_level, 'text': f',处理状态为', 'final_state': final_state } @@ -1578,7 +1578,7 @@ def get_flow_phase_detail(src_dir, turn_type_list, cross_phase): phase_suggestion = [] if not cross_phase: return phase_suggestion - for item in cross_phase: + for item in cross_phase.data: # 单个元素的含义为一个周计划 schedule_suggestion = [] 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] planid = tp_info.planid plan_name = tp_info.plan_name - stage_list = tp_info.stages + stage_list = tp_info.stage_list for stage in stage_list: phases_name = stage.phases_name 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): phase_suggestion = [] - for item in cross_phase: + if not cross_phase: + return phase_suggestion + for item in cross_phase.data: # 单个元素的含义为一个周计划 schedule_suggestion = [] 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] planid = tp_info.planid plan_name = tp_info.plan_name - stage_list = tp_info.stages + stage_list = tp_info.stage_list for stage in stage_list: phases_name = stage.phases_name 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 if is_tide: - for item in cross_phase: + for item in cross_phase.data: stages_info = item.tps[0].stages for stage in stages_info: phases_name = stage.phases_name