Commit 0897f51a authored by zhengjinlei's avatar zhengjinlei

更改分数

parent 2218555b
...@@ -37,18 +37,18 @@ def get_inspect_rule(task): ...@@ -37,18 +37,18 @@ def get_inspect_rule(task):
service_items = list(set(rule['scoreItemIds']).intersection(set(score_item_ids))) service_items = list(set(rule['scoreItemIds']).intersection(set(score_item_ids)))
items = ScoreItems.objects.filter(id__in=service_items).values('name', 'score', 'scoreType') items = ScoreItems.objects.filter(id__in=service_items).values('name', 'score', 'scoreType')
for item in items: for item in items:
score_item_service[item['name']] = item['score'] if item['scoreType'] == 1 else -item['score'] score_item_service[item['id']] = item['score'] if item['scoreType'] == 1 else -item['score']
elif rule['type'] == '业务类': elif rule['type'] == '业务类':
business_score = ScoreItems.objects.filter(id__in=rule['scoreItemIds']).aggregate(ss=Sum('score'))['ss'] business_score = ScoreItems.objects.filter(id__in=rule['scoreItemIds']).aggregate(ss=Sum('score'))['ss']
business_items = list(set(rule['scoreItemIds']).intersection(set(score_item_ids))) business_items = list(set(rule['scoreItemIds']).intersection(set(score_item_ids)))
items = ScoreItems.objects.filter(id__in=business_items).values('name', 'score', 'scoreType') items = ScoreItems.objects.filter(id__in=business_items).values('name', 'score', 'scoreType')
for item in items: for item in items:
score_item_business[item['name']] = item['score'] if item['scoreType'] == 1 else -item['score'] score_item_business[item['id']] = item['score'] if item['scoreType'] == 1 else -item['score']
elif rule['type'] == '0分项': elif rule['type'] == '0分项':
zero_items = list(set(rule['scoreItemIds']).intersection(set(score_item_ids))) zero_items = list(set(rule['scoreItemIds']).intersection(set(score_item_ids)))
items = ScoreItems.objects.filter(id__in=zero_items).values('name', 'score', 'scoreType') items = ScoreItems.objects.filter(id__in=zero_items).values('name', 'score', 'scoreType')
for item in items: for item in items:
score_item_zero[item['name']] = item['score'] if item['scoreType'] == 1 else -item['score'] score_item_zero[item['id']] = item['score'] if item['scoreType'] == 1 else -item['score']
return service_score, business_score, validate_zero, score_item_service, score_item_business, score_item_zero return service_score, business_score, validate_zero, score_item_service, score_item_business, score_item_zero
...@@ -149,11 +149,11 @@ def single_score_stat(t, create_date, stat_count=0): ...@@ -149,11 +149,11 @@ def single_score_stat(t, create_date, stat_count=0):
validate_zero = 0 validate_zero = 0
for m in score_item: for m in score_item:
if m['scoreItemName'] in score_item_service.keys(): if m['scoreItemId'] in score_item_service.keys():
service_score -= m['score'] if m['scoreType'] == 1 else -m['score'] service_score -= m['score'] if m['scoreType'] == 1 else -m['score']
if m['scoreItemName'] in score_item_business.keys(): if m['scoreItemId'] in score_item_business.keys():
business_score -= m['score'] if m['scoreType'] == 1 else -m['score'] business_score -= m['score'] if m['scoreType'] == 1 else -m['score']
if m['scoreItemName'] in score_item_zero.keys(): if m['scoreItemId'] in score_item_zero.keys():
validate_zero += 1 validate_zero += 1
if validate_zero > 0: if validate_zero > 0:
score = 0 score = 0
......
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