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:
|
if metric in parameters.METRIC_TO_RECORD_TYPE:
|
||||||
record_ids = _intersect(
|
record_ids = _intersect(
|
||||||
record_ids,
|
record_ids,
|
||||||
memory_storage_inst.get_record_ids_by_type(
|
memory_storage_inst.get_record_ids_by_types(
|
||||||
parameters.METRIC_TO_RECORD_TYPE[metric]))
|
parameters.METRIC_TO_RECORD_TYPE[metric]))
|
||||||
|
|
||||||
if 'tm_marks' in metric:
|
if 'tm_marks' in metric:
|
||||||
@@ -268,13 +268,6 @@ def mark_finalize(record):
|
|||||||
|
|
||||||
|
|
||||||
def person_day_filter(result, record, param_id, context):
|
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)
|
day = utils.timestamp_to_day(record.date)
|
||||||
# fact that record-days are grouped by days in some order is used
|
# fact that record-days are grouped by days in some order is used
|
||||||
if context.get('last_processed_day') != day:
|
if context.get('last_processed_day') != day:
|
||||||
|
|||||||
@@ -152,8 +152,9 @@ class CachedMemoryStorage(MemoryStorage):
|
|||||||
def get_record_ids(self):
|
def get_record_ids(self):
|
||||||
return self.records.keys()
|
return self.records.keys()
|
||||||
|
|
||||||
def get_record_ids_by_type(self, record_type):
|
def get_record_ids_by_types(self, record_types):
|
||||||
return self.record_types_index.get(record_type, set())
|
return self._get_record_ids_from_index(record_types,
|
||||||
|
self.record_types_index)
|
||||||
|
|
||||||
def get_records(self, record_ids):
|
def get_records(self, record_ids):
|
||||||
for i in record_ids:
|
for i in record_ids:
|
||||||
|
|||||||
@@ -43,17 +43,18 @@ METRIC_LABELS = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
METRIC_TO_RECORD_TYPE = {
|
METRIC_TO_RECORD_TYPE = {
|
||||||
'loc': 'commit',
|
'loc': ['commit'],
|
||||||
'commits': 'commit',
|
'commits': ['commit'],
|
||||||
'marks': 'mark',
|
'marks': ['mark'],
|
||||||
'emails': 'email',
|
'emails': ['email'],
|
||||||
'bpd': 'bpd',
|
'bpd': ['bpd'],
|
||||||
'bpc': 'bpc',
|
'bpc': ['bpc'],
|
||||||
'filed-bugs': 'bugf',
|
'filed-bugs': ['bugf'],
|
||||||
'resolved-bugs': 'bugr',
|
'resolved-bugs': ['bugr'],
|
||||||
'members': 'member',
|
'members': ['member'],
|
||||||
'ci': 'ci_vote',
|
'person-day': ['mark', 'patch', 'email', 'bpd', 'bugf'],
|
||||||
'patches': 'patch',
|
'ci': ['ci_vote'],
|
||||||
|
'patches': ['patch'],
|
||||||
}
|
}
|
||||||
|
|
||||||
FILTER_PARAMETERS = ['release', 'project_type', 'module', 'company', 'user_id',
|
FILTER_PARAMETERS = ['release', 'project_type', 'module', 'company', 'user_id',
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ def open_reviews(module):
|
|||||||
modules = [module]
|
modules = [module]
|
||||||
|
|
||||||
review_ids = (memory_storage_inst.get_record_ids_by_modules(modules) &
|
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 = []
|
waiting_on_reviewer = []
|
||||||
total_open = 0
|
total_open = 0
|
||||||
@@ -196,10 +196,8 @@ def _get_punch_card_data(records):
|
|||||||
def _get_activity_summary(record_ids):
|
def _get_activity_summary(record_ids):
|
||||||
memory_storage_inst = vault.get_memory_storage()
|
memory_storage_inst = vault.get_memory_storage()
|
||||||
|
|
||||||
types = ['mark', 'patch', 'email', 'bpd', 'bpc', 'ci_vote']
|
record_ids_by_type = memory_storage_inst.get_record_ids_by_types(
|
||||||
record_ids_by_type = set()
|
['mark', 'patch', 'email', 'bpd', 'bpc', 'ci_vote'])
|
||||||
for t in types:
|
|
||||||
record_ids_by_type |= memory_storage_inst.get_record_ids_by_type(t)
|
|
||||||
|
|
||||||
record_ids &= record_ids_by_type
|
record_ids &= record_ids_by_type
|
||||||
punch_card_data = _get_punch_card_data(
|
punch_card_data = _get_punch_card_data(
|
||||||
|
|||||||
Reference in New Issue
Block a user