Browse Source

test_info: 增加数据总量的返回

Signed-off-by: binren <zhangbr@elab-plus.com>
binren 5 years ago
parent
commit
dba8a21783
1 changed files with 11 additions and 0 deletions
  1. 11 0
      test_info.py

+ 11 - 0
test_info.py

@@ -75,6 +75,15 @@ class TestInfo(object):
             testcase_id = %s
     '''
 
+    sql_5 = '''
+        SELECT
+            count(1)
+        FROM
+            f_t_daren_score_2
+        WHERE
+            testcase_id = %s
+    '''
+
     def __init__(self):
         # self.shangju_db = MysqlDB('shangju')
         self.bi_report_db = MysqlDB('bi_report')
@@ -89,11 +98,13 @@ class TestInfo(object):
             people = self.bi_report_db.select(self.sql_4, [testcase_id])[0][0]
             finished = self.bi_report_db.select(self.sql_3, [testcase_id])[0][0]
             result = self.bi_report_db.select(self.sql_1, [testcase_id])
+            count = self.bi_report_db.select(self.sql_5, [testcase_id])
             answers = []
             for index, data in enumerate(result):
                 if index == 0:
                     response['testcase_id'] = data[0]
                     response['title'] = data[1]
+                    response['答题记录数'] = count[0][0]
                     response['答题人数'] = people
                     response['完成人数'] = finished
                     if people != 0: