Commit eded024e authored by lvshibao's avatar lvshibao

rules页面修改

parent 91b13347
...@@ -74,8 +74,8 @@ class DataApi(viewsets.ViewSet): ...@@ -74,8 +74,8 @@ class DataApi(viewsets.ViewSet):
:param req: :param req:
:return: :return:
""" """
city_id = req.data.get('city', None) city_id = req.GET.get('city', None)
country_id = req.data.get('country', None) country_id = req.GET.get('country', None)
task_condition = req.data.get('date_condition', {}) task_condition = req.data.get('date_condition', {})
team_names = get_team_names(city_id, country_id) team_names = get_team_names(city_id, country_id)
......
...@@ -450,17 +450,15 @@ class TasksApi(viewsets.ViewSet): ...@@ -450,17 +450,15 @@ class TasksApi(viewsets.ViewSet):
city_id = req.data.get('city', None) city_id = req.data.get('city', None)
country_id = req.data.get('country', None) country_id = req.data.get('country', None)
task_condition = req.data.get('date_condition', {})
team_names = get_team_names(city_id, country_id) team_names = get_team_names(city_id, country_id)
task_condition = req.data.get('date_condition', {})
task_condition['task__in'] = team_names task_condition['task__in'] = team_names
call_count = SeatStat.objects.filter(**task_condition).aggregate(Sum("validate_session"))['validate_session__sum'] call_count = SeatStat.objects.filter(**task_condition).aggregate(Sum("validate_session"))['validate_session__sum']
task_condition = req.data.get('date_condition', {})
task_condition['task__in'] = team_names
# tasks = RulesStat.objects.filter(**task_condition).values('rule', 'sessionCollectionId', 'rule_num') # tasks = RulesStat.objects.filter(**task_condition).values('rule', 'sessionCollectionId', 'rule_num')
tasks = RulesStat.objects.all().filter(**task_condition) \ tasks = RulesStat.objects.all().filter(**task_condition) \
.extra(select={'rule': "rule", 'sessionCollectionId': 'sessionCollectionId'}) \ .extra(select={'rule': "rule", 'sessionCollectionId': 'sessionCollectionId'}) \
...@@ -482,7 +480,6 @@ class TasksApi(viewsets.ViewSet): ...@@ -482,7 +480,6 @@ class TasksApi(viewsets.ViewSet):
v['call_count'] = call_count v['call_count'] = call_count
data_sort.append(v) data_sort.append(v)
# data_sort = sorted(data_sort, key=lambda x: x['count'], reverse=True) # data_sort = sorted(data_sort, key=lambda x: x['count'], reverse=True)
print('finish')
return Response({'code': 0, 'msg': 'success', 'data': data_sort}) return Response({'code': 0, 'msg': 'success', 'data': data_sort})
@action(['post'], detail=False) @action(['post'], detail=False)
......
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