diff --git a/app/eva_common.py b/app/eva_common.py index d773a5b..24956d9 100644 --- a/app/eva_common.py +++ b/app/eva_common.py @@ -1480,6 +1480,15 @@ def gen_phase_problems(nodeid, area_id, crossid, time_range, date_list, min_date def gen_err_phase_problems(max_date, crossid, min_date, time_range): cross_examine_records = db_cross.query_cross_examine_records_nostarthm(max_date, crossid, min_date) + final_res = [] + for row in cross_examine_records: + start_hm = convert_time(row['start_hm']) + end_hm = convert_time(row['end_hm']) + if not time_overlap(time_range, [start_hm + '-' + end_hm]): + continue + if row['level_color'] == 4 or row['final_state'] == 6: + continue + final_res.append(row) detail = [] suggestions, total_num = [], 0 color_dict = { @@ -1496,7 +1505,7 @@ def gen_err_phase_problems(max_date, crossid, min_date, time_range): 5: '核查无异常', 6: '自动结束' } - if len(cross_examine_records) > 0: + if len(final_res) > 0: total_num = 1 detail = [] suggestions = [ @@ -1508,13 +1517,9 @@ def gen_err_phase_problems(max_date, crossid, min_date, time_range): ] } ] - for cross_examine_record in cross_examine_records: + for cross_examine_record in final_res: start_hm = convert_time(cross_examine_record['start_hm']) end_hm = convert_time(cross_examine_record['end_hm']) - if not time_overlap(time_range, [start_hm + '-' + end_hm]): - continue - if cross_examine_record['level_color'] == 4 or cross_examine_record['final_state'] == 6: - continue first_date = cross_examine_record['first_date'] color_level = color_dict[cross_examine_record['level_color']] final_state = state_dict[cross_examine_record['final_state']]