Fixed index ordering in contribution report

Order of indexes is made the same as primary metric "reviews"

Closes bug 1308019

Change-Id: Ia39920e5f96f3cf73fda78870b81287a38a0f7a2
This commit is contained in:
Ilya Shakhat 2014-04-15 18:11:24 +04:00
parent be1c08b041
commit a665fe9cfe
3 changed files with 17 additions and 15 deletions

View File

@ -45,10 +45,10 @@ table.dataTable tr.odd { background-color: #fbfafa; }
table.dataTable tr.even { background-color: white; }
table.dataTable tr.odd td.sorting_1 { background-color: #eef1f4; }
table.dataTable tr.odd td.sorting_2 { background-color: #DADCFF; }
table.dataTable tr.odd td.sorting_2 { background-color: #eef1f4; }
table.dataTable tr.odd td.sorting_3 { background-color: #E0E2FF; }
table.dataTable tr.even td.sorting_1 { background-color: #f8f9fa; }
table.dataTable tr.even td.sorting_2 { background-color: #F2F3FF; }
table.dataTable tr.even td.sorting_2 { background-color: #E0E8E8; }
table.dataTable tr.even td.sorting_3 { background-color: #F9F9FF; }

View File

@ -68,7 +68,8 @@ Contribution into {{ module }} for the last {{ days }} days
if (table_id) {
$("#" + table_id).dataTable({
"aaSorting": [
[ sort_by_column, "desc" ]
[ sort_by_column, "desc" ],
[ 0, "asc"]
],
"bFilter": true,
"bInfo": false,

View File

@ -116,12 +116,12 @@ def get_modules(records, metric_filter, finalize_handler):
'module')
def is_engineer_core_in_modules(user, modules):
is_core = False
def get_core_engineer_branch(user, modules):
is_core = None
for (module, branch) in user['core']:
if module in modules:
is_core = branch
if branch == 'master': # we need master, but stables are ok
if branch == 'master': # master is preferable, but stables are ok
break
return is_core
@ -140,7 +140,7 @@ def get_engineers(records, metric_filter, finalize_handler):
if finalize_handler:
record = finalize_handler(record)
user = vault.get_user_from_runtime_storage(record['id'])
record['core'] = is_engineer_core_in_modules(user, modules)
record['core'] = get_core_engineer_branch(user, modules)
return record
return _get_aggregated_stats(records, metric_filter,
@ -166,7 +166,7 @@ def get_engineers_extended(records):
user = vault.get_user_from_runtime_storage(record['id'])
record['company'] = user['companies'][-1]['company_name']
record['core'] = is_engineer_core_in_modules(user, modules)
record['core'] = get_core_engineer_branch(user, modules)
return record
def record_processing(result, record, param_id):
@ -179,18 +179,19 @@ def get_engineers_extended(records):
result_row['patch_count'] = (result_row.get('patch_count', 0) +
record['patch_count'])
result = dict((user_id, {'id': user_id, 'mark': 0, 'review': 0,
'commit': 0, 'email': 0, 'patch_count': 0,
'metric': 0})
for user_id in vault.get_memory_storage().get_user_ids())
result = {}
for record in records:
user_id = record['user_id']
if user_id not in result:
result[user_id] = {'id': user_id, 'mark': 0, 'review': 0,
'commit': 0, 'email': 0, 'patch_count': 0,
'metric': 0}
record_processing(result, record, 'user_id')
result[record['user_id']]['name'] = record['author_name']
result[user_id]['name'] = record['author_name']
response = result.values()
response.sort(key=lambda x: x['mark'], reverse=True)
response = [item for item in map(postprocessing, response) if item]
response.sort(key=lambda x: x['metric'], reverse=True)
utils.add_index(response)
return response