Commit ba2f79d3 authored by zhengjinlei's avatar zhengjinlei

取得分最低top10

parent 94899c82
......@@ -96,7 +96,7 @@ class TasksApi(viewsets.ViewSet):
:return:
"""
task_id = req.data.get('task', '')
num = req.data.get('num', '15')
num = req.data.get('num', '10')
start_date = req.data.get('start_date', (datetime.now()+timedelta(days=-30)).strftime('%Y-%m-%d'))
end_date = req.data.get('end_date', (datetime.now()+timedelta(days=1)).strftime('%Y-%m-%d'))
task_condition = {'createdAt__gte': start_date, 'createdAt__lt': end_date}
......@@ -132,7 +132,7 @@ class TasksApi(viewsets.ViewSet):
:return:
"""
task_id = req.data.get('task', '')
num = req.data.get('num', '15')
num = req.data.get('num', '10')
start_date = req.data.get('start_date', (datetime.now()+timedelta(days=-30)).strftime('%Y-%m-%d'))
end_date = req.data.get('end_date', (datetime.now()+timedelta(days=1)).strftime('%Y-%m-%d'))
task_condition = {'createdAt__gte': start_date, 'createdAt__lt': end_date}
......@@ -153,7 +153,7 @@ class TasksApi(viewsets.ViewSet):
return_data[agent_name] += check.score
else:
return_data[agent_name] = check.score
data_max = sorted(return_data.items(), key=lambda item: item[1], reverse=True)
data_max = sorted(return_data.items(), key=lambda item: item[1], reverse=False)
data_max = data_max[:int(num)]
data_max_return = {}
for dm in data_max:
......
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