|
@@ -68,7 +68,7 @@ class Mvp:
|
|
|
created
|
|
|
)
|
|
|
VALUES
|
|
|
- (%s, %s, %s, 1, 'binren', now())
|
|
|
+ (%s, %s, %s, 1, {}, now())
|
|
|
'''
|
|
|
|
|
|
def get_table_name(self, name):
|
|
@@ -89,7 +89,7 @@ class Mvp:
|
|
|
"""
|
|
|
params = self.tag_table.get(tag_type_name)
|
|
|
if params:
|
|
|
- return self.base_insert_sql.format(params[0], params[1])
|
|
|
+ return self.base_insert_sql.format(params[0], params[1], 'binren')
|
|
|
|
|
|
crowd = ['A', 'B', 'C', 'D', 'E', 'F']
|
|
|
|
|
@@ -281,7 +281,7 @@ class Mvp:
|
|
|
created
|
|
|
)
|
|
|
VALUES
|
|
|
- (%s, %s, %s, 1, 'binren', now())
|
|
|
+ (%s, %s, %s, 1, %s, now())
|
|
|
'''
|
|
|
|
|
|
"""
|
|
@@ -393,8 +393,10 @@ class Mvp:
|
|
|
city = people[1]
|
|
|
nld = people[2]
|
|
|
sex = people[3]
|
|
|
- if sex:
|
|
|
+ if sex and len(str(sex).split(',')) > 0:
|
|
|
sex = str(sex).split(',')[0]
|
|
|
+ else:
|
|
|
+ sex = '3'
|
|
|
sub_option_ids_1 = people[4]
|
|
|
testcaseid = people[5]
|
|
|
|
|
@@ -484,18 +486,22 @@ class Mvp:
|
|
|
girl = 0
|
|
|
for people in self.people_info_1:
|
|
|
if people.sex is not None and city == people.city and crowd == people.crowd and age == people.age:
|
|
|
- if people.sex == 1:
|
|
|
+ if people.sex == '1':
|
|
|
boy += 1
|
|
|
- if people.sex == 2:
|
|
|
+ if people.sex == '2':
|
|
|
girl += 1
|
|
|
crowd_info_id = self.get_crowd_info_id([city, age, crowd])
|
|
|
- if crowd_info_id:
|
|
|
+ if crowd_info_id and (boy + girl) > 0:
|
|
|
boy_rate = boy / (boy + girl)
|
|
|
- insert_data.append([crowd_info_id, 1, boy_rate])
|
|
|
+ insert_data.append([crowd_info_id, 1, boy_rate, 'binren'])
|
|
|
girl_rate = girl / (boy + girl)
|
|
|
- insert_data.append([crowd_info_id, 0, girl_rate])
|
|
|
- self.linshi_db.add_some(self.sql_22, insert_data)
|
|
|
- print('性别占比更新完成...')
|
|
|
+ insert_data.append([crowd_info_id, 0, girl_rate, 'binren'])
|
|
|
+ if len(insert_data) > 0:
|
|
|
+ self.linshi_db.truncate('mvp_crowd_info_gender_rate')
|
|
|
+ self.linshi_db.add_some(self.sql_22, insert_data)
|
|
|
+ print('性别占比更新完成...')
|
|
|
+ else:
|
|
|
+ print('无数据更新...')
|
|
|
|
|
|
def get_crowd_info_id(self, people_info):
|
|
|
for id_data in self.ids:
|