Correct mapping of person-day metric to record types
Also refactor metric-to-record-type mapping since now it is 1:N Change-Id: Ia0929b51dfbaddee848e9f095da65e2a9fc38a39
This commit is contained in:
@@ -172,7 +172,7 @@ def record_filter(ignore=None):
|
||||
if metric in parameters.METRIC_TO_RECORD_TYPE:
|
||||
record_ids = _intersect(
|
||||
record_ids,
|
||||
memory_storage_inst.get_record_ids_by_type(
|
||||
memory_storage_inst.get_record_ids_by_types(
|
||||
parameters.METRIC_TO_RECORD_TYPE[metric]))
|
||||
|
||||
if 'tm_marks' in metric:
|
||||
@@ -268,13 +268,6 @@ def mark_finalize(record):
|
||||
|
||||
|
||||
def person_day_filter(result, record, param_id, context):
|
||||
record_type = record.record_type
|
||||
if record_type == 'commit' or record_type == 'member':
|
||||
# 1. commit is attributed with the date of the merge which is not an
|
||||
# effort of the author (author's effort is represented in patches)
|
||||
# 2. registration on openstack.org is not an effort
|
||||
return
|
||||
|
||||
day = utils.timestamp_to_day(record.date)
|
||||
# fact that record-days are grouped by days in some order is used
|
||||
if context.get('last_processed_day') != day:
|
||||
|
||||
@@ -152,8 +152,9 @@ class CachedMemoryStorage(MemoryStorage):
|
||||
def get_record_ids(self):
|
||||
return self.records.keys()
|
||||
|
||||
def get_record_ids_by_type(self, record_type):
|
||||
return self.record_types_index.get(record_type, set())
|
||||
def get_record_ids_by_types(self, record_types):
|
||||
return self._get_record_ids_from_index(record_types,
|
||||
self.record_types_index)
|
||||
|
||||
def get_records(self, record_ids):
|
||||
for i in record_ids:
|
||||
|
||||
@@ -43,17 +43,18 @@ METRIC_LABELS = {
|
||||
}
|
||||
|
||||
METRIC_TO_RECORD_TYPE = {
|
||||
'loc': 'commit',
|
||||
'commits': 'commit',
|
||||
'marks': 'mark',
|
||||
'emails': 'email',
|
||||
'bpd': 'bpd',
|
||||
'bpc': 'bpc',
|
||||
'filed-bugs': 'bugf',
|
||||
'resolved-bugs': 'bugr',
|
||||
'members': 'member',
|
||||
'ci': 'ci_vote',
|
||||
'patches': 'patch',
|
||||
'loc': ['commit'],
|
||||
'commits': ['commit'],
|
||||
'marks': ['mark'],
|
||||
'emails': ['email'],
|
||||
'bpd': ['bpd'],
|
||||
'bpc': ['bpc'],
|
||||
'filed-bugs': ['bugf'],
|
||||
'resolved-bugs': ['bugr'],
|
||||
'members': ['member'],
|
||||
'person-day': ['mark', 'patch', 'email', 'bpd', 'bugf'],
|
||||
'ci': ['ci_vote'],
|
||||
'patches': ['patch'],
|
||||
}
|
||||
|
||||
FILTER_PARAMETERS = ['release', 'project_type', 'module', 'company', 'user_id',
|
||||
|
||||
@@ -98,7 +98,7 @@ def open_reviews(module):
|
||||
modules = [module]
|
||||
|
||||
review_ids = (memory_storage_inst.get_record_ids_by_modules(modules) &
|
||||
memory_storage_inst.get_record_ids_by_type('review'))
|
||||
memory_storage_inst.get_record_ids_by_types(['review']))
|
||||
|
||||
waiting_on_reviewer = []
|
||||
total_open = 0
|
||||
@@ -196,10 +196,8 @@ def _get_punch_card_data(records):
|
||||
def _get_activity_summary(record_ids):
|
||||
memory_storage_inst = vault.get_memory_storage()
|
||||
|
||||
types = ['mark', 'patch', 'email', 'bpd', 'bpc', 'ci_vote']
|
||||
record_ids_by_type = set()
|
||||
for t in types:
|
||||
record_ids_by_type |= memory_storage_inst.get_record_ids_by_type(t)
|
||||
record_ids_by_type = memory_storage_inst.get_record_ids_by_types(
|
||||
['mark', 'patch', 'email', 'bpd', 'bpc', 'ci_vote'])
|
||||
|
||||
record_ids &= record_ids_by_type
|
||||
punch_card_data = _get_punch_card_data(
|
||||
|
||||
Reference in New Issue
Block a user