Browse Source

mvp: 分母计算逻辑修改

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

+ 3 - 4
mvp.py

@@ -89,7 +89,7 @@ class Mvp:
     sql_4 = 'select nld from f_t_daren_score_2 group by nld'
 
     # 根据城市,年龄段,人群分类统计答题记录数
-    sql_5 = 'select group_type, COUNT(uuid) from f_t_daren_score_2 where uuid in %s group by group_type '
+    sql_5 = 'select testcase_id, COUNT(uuid) from f_t_daren_score_2 where uuid in %s group by testcase_id '
 
     # 根据父选项获取子选项id列表
     sql_6 = 'SELECT c.id, c.sub_question_id, c.content FROM bq_sub_option c WHERE c.father_id in (SELECT a.id FROM ' \
@@ -98,12 +98,12 @@ class Mvp:
             'and a.status = 1 and b.status = 1) and c.status = 1 '
 
     # 根据子题id获取包含子题id的测试
-    sql_7 = 'select group_type from bq_testcase where status = 1 and FIND_IN_SET(%s, question_ids)'
+    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'
+            '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 ' \
@@ -504,7 +504,6 @@ class Mvp:
                             behavior_data = behavior_data_1
                         if behavior_data:
                             module_scores.extend(self.module_score(crowd_type, city, age, behavior_data))
-        # return result
         # data_list = []
         # for e in data_start:
         #     for key in e.keys():