Pārlūkot izejas kodu

tongce: 数据清洗逻辑调整

Signed-off-by: binren <zhangbr@elab-plus.com>
binren 5 gadi atpakaļ
vecāks
revīzija
cd9bf5620a
1 mainītis faili ar 7 papildinājumiem un 8 dzēšanām
  1. 7 8
      tongce.py

+ 7 - 8
tongce.py

@@ -224,7 +224,7 @@ class TongCe:
 								 b.sub_option_content  AS sex
                             FROM
                                 f_t_daren_score_2 a
-                            LEFT JOIN d_shangju_tiku_02 b ON a.score = b.sub_option_id
+                            LEFT JOIN d_shangju_tiku_02 b ON (a.score = b.sub_option_id or a.score = b.score)
                             WHERE
                                 a.testcase_id IN (84, 85, 86, 87)
                             AND b.father_id = 47
@@ -240,7 +240,7 @@ class TongCe:
                             b.sub_option_content  AS nld
                         FROM
                             f_t_daren_score_2 a
-                        LEFT JOIN d_shangju_tiku_02 b ON a.score = b.sub_option_id
+                        LEFT JOIN d_shangju_tiku_02 b ON (a.score = b.sub_option_id or a.score = b.score)
                         WHERE
                             a.testcase_id IN (84, 85, 86, 87)
                         AND b.father_id = 48
@@ -256,7 +256,7 @@ class TongCe:
 							 b.sub_option_content AS zhifuli
                         FROM
                             f_t_daren_score_2 a
-                        LEFT JOIN d_shangju_tiku_02 b ON a.score = b.sub_option_id
+                        LEFT JOIN d_shangju_tiku_02 b ON (a.score = b.sub_option_id or a.score = b.score)
                         WHERE
                             a.testcase_id IN (84, 85, 86, 87)
                         AND b.father_id = 234
@@ -272,7 +272,7 @@ class TongCe:
                            b.sub_option_content AS city
                         FROM
                             f_t_daren_score_2 a
-                        LEFT JOIN d_shangju_tiku_02 b ON a.score = b.sub_option_id
+                        LEFT JOIN d_shangju_tiku_02 b ON (a.score = b.sub_option_id or a.score = b.score)
                         WHERE
                             a.testcase_id IN (84, 85, 86, 87)
                         AND b.father_id = 254
@@ -288,7 +288,7 @@ class TongCe:
                             b.sub_option_content AS juzhujiegou
                         FROM
                             f_t_daren_score_2 a
-                        LEFT JOIN d_shangju_tiku_02 b ON a.score = b.sub_option_id
+                        LEFT JOIN d_shangju_tiku_02 b ON (a.score = b.sub_option_id or a.score = b.score)
                         WHERE
                             a.testcase_id IN (84, 85, 86, 87)
                         AND b.father_id = 211
@@ -317,7 +317,6 @@ class TongCe:
                     a.testcase_id = b.testcase_id
                 AND  (a.score = b.sub_option_id or a.score = b.score)
                 AND a.testcase_id IN (84, 85, 86, 87)
-								AND a.sub_question_id = 417
             ) m ON x.uuid = m.uuid
     '''
 
@@ -485,7 +484,7 @@ class TongCe:
         # self.linshi_db.truncate('mvp_page_display_match')
         # self.linshi_db.add_some(self.sql_3, match_data)
         self.match_data_info = self.get_option_match_info()
-        # self.linshi_db.truncate('mvp_page_display_data')
+        self.linshi_db.truncate('mvp_page_display_data')
 
         # 筛选写入data的数据
         count = 0
@@ -538,7 +537,7 @@ class TongCe:
                             match_id = md[0]
                             option_name_alias = md[3]
                             isnert_data_all.append([5405, match_id, rule_id, option_name_alias, q_s[2]])
-            # self.linshi_db.add_some(self.sql_6, isnert_data_all)
+            self.linshi_db.add_some(self.sql_6, isnert_data_all)
             count += len(isnert_data_all)
             return {'写入库中的数据': count, '无数据': len(no_data_case)}
         except Exception as e: