Browse Source

mvp: 人群分类映射增加

Signed-off-by: binren <zhangbr@elab-plus.com>
binren 5 years ago
parent
commit
d3555592fd
1 changed files with 22 additions and 3 deletions
  1. 22 3
      mvp.py

+ 22 - 3
mvp.py

@@ -57,6 +57,13 @@ class Mvp:
         '1977': 'E',
         '1978': 'F',
         '1979': 'G',
+        '1813': 'A',
+        '1814': 'B',
+        '1815': 'C',
+        '1816': 'D',
+        '1817': 'E',
+        '1818': 'F',
+        '1819': 'G'
     }
     base_insert_sql = 'insert into {}(crowd_info_id, {}, standard_value, status) values(%s, %s, %s, '\
                       '1) '
@@ -106,9 +113,21 @@ class Mvp:
     sql_7 = 'select id from bq_testcase where status = 1 and FIND_IN_SET(%s, question_ids)'
 
     # 根据子选项id统计答题数
-    sql_8 = 'SELECT count(1) FROM f_t_daren_score_2 a LEFT JOIN d_shangju_tiku_02 b ON a.sub_question_id = ' \
-            'b.sub_question_id AND (a.score  = b.score or a.score = b.sub_option_id) and a.testcase_id = ' \
-            'b.testcase_id WHERE b.sub_option_id in %s and a.uuid in %s '
+    sql_8 = '''
+        SELECT
+            count(1)
+        FROM
+            f_t_daren_score_2 a
+        LEFT JOIN d_shangju_tiku_02 b ON a.sub_question_id = b.sub_question_id
+        AND (
+            a.score = b.score
+            OR a.score = b.sub_option_id
+        )
+        AND a.testcase_id = b.testcase_id
+        WHERE
+            b.sub_option_id IN % s
+        AND a.uuid IN % s
+    '''
 
     # 获取一个uuid下答题的子选项id列表
     sql_10 = 'select  DISTINCT uuid, GROUP_CONCAT(DISTINCT b.sub_option_id)  from f_t_daren_score_2 a left join ' \