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:
@@ -45,10 +45,10 @@ table.dataTable tr.odd { background-color: #fbfafa; }
|
|||||||
table.dataTable tr.even { background-color: white; }
|
table.dataTable tr.even { background-color: white; }
|
||||||
|
|
||||||
table.dataTable tr.odd td.sorting_1 { background-color: #eef1f4; }
|
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.odd td.sorting_3 { background-color: #E0E2FF; }
|
||||||
table.dataTable tr.even td.sorting_1 { background-color: #f8f9fa; }
|
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; }
|
table.dataTable tr.even td.sorting_3 { background-color: #F9F9FF; }
|
||||||
|
|
||||||
|
|
||||||
|
@@ -68,7 +68,8 @@ Contribution into {{ module }} for the last {{ days }} days
|
|||||||
if (table_id) {
|
if (table_id) {
|
||||||
$("#" + table_id).dataTable({
|
$("#" + table_id).dataTable({
|
||||||
"aaSorting": [
|
"aaSorting": [
|
||||||
[ sort_by_column, "desc" ]
|
[ sort_by_column, "desc" ],
|
||||||
|
[ 0, "asc"]
|
||||||
],
|
],
|
||||||
"bFilter": true,
|
"bFilter": true,
|
||||||
"bInfo": false,
|
"bInfo": false,
|
||||||
|
@@ -116,12 +116,12 @@ def get_modules(records, metric_filter, finalize_handler):
|
|||||||
'module')
|
'module')
|
||||||
|
|
||||||
|
|
||||||
def is_engineer_core_in_modules(user, modules):
|
def get_core_engineer_branch(user, modules):
|
||||||
is_core = False
|
is_core = None
|
||||||
for (module, branch) in user['core']:
|
for (module, branch) in user['core']:
|
||||||
if module in modules:
|
if module in modules:
|
||||||
is_core = branch
|
is_core = branch
|
||||||
if branch == 'master': # we need master, but stables are ok
|
if branch == 'master': # master is preferable, but stables are ok
|
||||||
break
|
break
|
||||||
return is_core
|
return is_core
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ def get_engineers(records, metric_filter, finalize_handler):
|
|||||||
if finalize_handler:
|
if finalize_handler:
|
||||||
record = finalize_handler(record)
|
record = finalize_handler(record)
|
||||||
user = vault.get_user_from_runtime_storage(record['id'])
|
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 record
|
||||||
|
|
||||||
return _get_aggregated_stats(records, metric_filter,
|
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'])
|
user = vault.get_user_from_runtime_storage(record['id'])
|
||||||
record['company'] = user['companies'][-1]['company_name']
|
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
|
return record
|
||||||
|
|
||||||
def record_processing(result, record, param_id):
|
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) +
|
result_row['patch_count'] = (result_row.get('patch_count', 0) +
|
||||||
record['patch_count'])
|
record['patch_count'])
|
||||||
|
|
||||||
result = dict((user_id, {'id': user_id, 'mark': 0, 'review': 0,
|
result = {}
|
||||||
'commit': 0, 'email': 0, 'patch_count': 0,
|
|
||||||
'metric': 0})
|
|
||||||
for user_id in vault.get_memory_storage().get_user_ids())
|
|
||||||
|
|
||||||
for record in records:
|
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')
|
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 = result.values()
|
||||||
response.sort(key=lambda x: x['mark'], reverse=True)
|
|
||||||
response = [item for item in map(postprocessing, response) if item]
|
response = [item for item in map(postprocessing, response) if item]
|
||||||
|
response.sort(key=lambda x: x['metric'], reverse=True)
|
||||||
utils.add_index(response)
|
utils.add_index(response)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
Reference in New Issue
Block a user