报表优化1

This commit is contained in:
Àî×ÚÕñ 2022-09-19 11:15:39 +08:00
parent 9d4e4cc1e4
commit 0206d806a4

View File

@ -1122,25 +1122,25 @@ async def stage_success_form(
chk_num5 = res_data['wait_work_num'] chk_num5 = res_data['wait_work_num']
chk_num7 = res_data['work_in_num'] chk_num7 = res_data['work_in_num']
if chk_num1 and chk_num2: if chk_num1 and chk_num2:
chance_1 = round(chk_num2 / chk_num1, 2) chance_1 = '{:.2%}'.format(chk_num2 / chk_num1)
else: else:
chance_1 = 0 chance_1 = '0%'
if chk_num2 and chk_num3: if chk_num2 and chk_num3:
chance_2 = round(chk_num3 / chk_num2, 2) chance_2 = '{:.2%}'.format(chk_num3 / chk_num2)
else: else:
chance_2 = 0 chance_2 = '0%'
if chk_num3 and chk_num4: if chk_num3 and chk_num4:
chance_3 = round(chk_num4 / chk_num3, 2) chance_3 = '{:.2%}'.format(chk_num4 / chk_num3)
else: else:
chance_3 = 0 chance_3 = '0%'
if chk_num4 and chk_num5: if chk_num4 and chk_num5:
chance_4 = round(chk_num5 / chk_num4, 2) chance_4 = '{:.2%}'.format(chk_num5 / chk_num4)
else: else:
chance_4 = 0 chance_4 = '0%'
if chk_num5 and chk_num7: if chk_num5 and chk_num7:
chance_5 = round(chk_num7 / chk_num5, 2) chance_5 = '{:.2%}'.format(chk_num7 / chk_num5)
else: else:
chance_5 = 0 chance_5 = '0%'
res_msg[res_name].update({ res_msg[res_name].update({
'chance_1': chance_1, 'chance_1': chance_1,
'chance_2': chance_2, 'chance_2': chance_2,
@ -1525,14 +1525,14 @@ async def owner_form(
work_num = len([1 for i in data_list if i['interview_stage'] >= 7]) work_num = len([1 for i in data_list if i['interview_stage'] >= 7])
if offer_num: if offer_num:
offer_chance = round(offer_num / count_num, 2) offer_chance = '{:.2%}'.format(offer_num / count_num)
else: else:
offer_chance = 0 offer_chance = '0%'
if work_num: if work_num:
work_chance = round(work_num / count_num, 2) work_chance = '{:.2%}'.format(work_num / count_num)
else: else:
work_chance = 0 work_chance = '0%'
res_msg[key]['count'] = count_num res_msg[key]['count'] = count_num
res_msg[key]['offer_num'] = offer_num res_msg[key]['offer_num'] = offer_num
res_msg[key]['work_num'] = work_num res_msg[key]['work_num'] = work_num
@ -2059,17 +2059,17 @@ async def find_worker_form(
res_data.append(res_msg1) res_data.append(res_msg1)
res_msg2 = { res_msg2 = {
'title': '占比', 'title': '占比',
'未评级': round(res_msg1['未评级'] / res_msg['总人数'], 2), '未评级': '{:.2%}'.format(res_msg1['未评级'] / res_msg['总人数']),
'p1-p3': round(res_msg1['p1-p3'] / res_msg['总人数'], 2), 'p1-p3': '{:.2%}'.format(res_msg1['p1-p3'] / res_msg['总人数']),
'p4': round(res_msg1['p4'] / res_msg['总人数'], 2), 'p4': '{:.2%}'.format(res_msg1['p4'] / res_msg['总人数']),
'p5': round(res_msg1['p5'] / res_msg['总人数'], 2), 'p5': '{:.2%}'.format(res_msg1['p5'] / res_msg['总人数']),
'p6': round(res_msg1['p6'] / res_msg['总人数'], 2), 'p6': '{:.2%}'.format(res_msg1['p6'] / res_msg['总人数']),
'p7': round(res_msg1['p7'] / res_msg['总人数'], 2), 'p7': '{:.2%}'.format(res_msg1['p7'] / res_msg['总人数']),
'p8': round(res_msg1['p8'] / res_msg['总人数'], 2), 'p8': '{:.2%}'.format(res_msg1['p8'] / res_msg['总人数']),
'm1': round(res_msg1['m1'] / res_msg['总人数'], 2), 'm1': '{:.2%}'.format(res_msg1['m1'] / res_msg['总人数']),
'm2': round(res_msg1['m2'] / res_msg['总人数'], 2), 'm2': '{:.2%}'.format(res_msg1['m2'] / res_msg['总人数']),
'm3': round(res_msg1['m3'] / res_msg['总人数'], 2), 'm3': '{:.2%}'.format(res_msg1['m3'] / res_msg['总人数']),
'm4': round(res_msg1['m4'] / res_msg['总人数'], 2), 'm4': '{:.2%}'.format(res_msg1['m4'] / res_msg['总人数']),
} }
res_data.append(res_msg2) res_data.append(res_msg2)
level_list = { level_list = {