Commit 04441033 authored by zhengjinlei's avatar zhengjinlei

首页统计

parent a3fa669b
...@@ -560,7 +560,10 @@ class TasksApi(viewsets.ViewSet): ...@@ -560,7 +560,10 @@ class TasksApi(viewsets.ViewSet):
task_condition = {'create_date__gte': q_start_date, 'create_date__lt': q_end_date} task_condition = {'create_date__gte': q_start_date, 'create_date__lt': q_end_date}
if task_id: if task_id:
task_condition['task'] = task_id task_condition['task'] = task_id
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)\
.extra(select={'rule': "rule", 'sessionCollectionId': 'sessionCollectionId'})\
.values('rule','sessionCollectionId').annotate(rule_num=Count('id')).order_by('-rule_num')
for t in tasks: for t in tasks:
name = t['rule'] name = t['rule']
if name in return_data.keys(): if name in return_data.keys():
......
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