Commit f356c3df authored by zhengjinlei's avatar zhengjinlei

重新计算得分

parent 9c114833
...@@ -164,9 +164,9 @@ def single_score_stat(t, create_date, stat_count=0): ...@@ -164,9 +164,9 @@ def single_score_stat(t, create_date, stat_count=0):
seat['total_session'] += 1 seat['total_session'] += 1
seat['validate_session'] += 1 if check['violationRuleCount'] > 0 else 0 seat['validate_session'] += 1 if check['violationRuleCount'] > 0 else 0
seat['validate_num'] += len(score_item) seat['validate_num'] += len(score_item)
seat['score'] = round((seat['score'] + score) / 2, 2) seat['score'] += score
seat['service_score'] = round((seat['service_score'] + service_score) / 2, 2) seat['service_score'] += service_score
seat['business_score'] = round((seat['business_score'] + business_score) / 2, 2) seat['business_score'] += business_score
else: else:
seat_dict[check['agentName']] = {'create_date': create_date, 'agentName': check['agentName'], seat_dict[check['agentName']] = {'create_date': create_date, 'agentName': check['agentName'],
'taskId': check['taskId'], 'taskId': check['taskId'],
...@@ -177,7 +177,9 @@ def single_score_stat(t, create_date, stat_count=0): ...@@ -177,7 +177,9 @@ def single_score_stat(t, create_date, stat_count=0):
seat_dict[check['agentName']]['validate_session'] = 1 if check['violationRuleCount'] > 0 else 0 seat_dict[check['agentName']]['validate_session'] = 1 if check['violationRuleCount'] > 0 else 0
seat_dict[check['agentName']]['validate_num'] = len(score_item) seat_dict[check['agentName']]['validate_num'] = len(score_item)
for k, v in seat_dict.items(): for k, v in seat_dict.items():
seat_obj = {'agentName': k} seat_obj = {'agentName': k, 'score': round(v.pop('score') / v['total_session'], 2),
'business_score': round(v.pop('business_score') / v['total_session'], 2),
'service_score': round(v.pop('service_score') / v['total_session'], 2)}
seat_obj.update(v) seat_obj.update(v)
seat_list.append(ScoreStat(**seat_obj)) seat_list.append(ScoreStat(**seat_obj))
ScoreStat.objects.bulk_create(seat_list) ScoreStat.objects.bulk_create(seat_list)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment