Skip to content

Commit

Permalink
Fixed organizations+coutries filer for SCM and ITS (done in Liferay).
Browse files Browse the repository at this point in the history
  • Loading branch information
Alvaro del Castillo authored and Automator owl committed Apr 29, 2015
1 parent b4769ab commit 61499c8
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion vizgrimoire/ITS.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def get_filter_items(cls, filter_, startdate, enddate, identities_db):
elif (filter_name == "people2"):
metric = DataSource.get_metrics("people2", cls)
elif (filter_name == "company"+MetricFilters.DELIMITER+"country"):
metric = DataSource.get_metrics("companies+countries", cls)
metric = DataSource.get_metrics("organizations+countries", cls)
else:
logging.error(filter_name + " not supported")
return items
Expand Down
2 changes: 1 addition & 1 deletion vizgrimoire/SCM.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def get_filter_items(filter_, startdate, enddate, identities_db):
elif (filter_name == "people2"):
metric = DataSource.get_metrics("people2", SCM)
elif (filter_name == "company"+MetricFilters.DELIMITER+"country"):
metric = DataSource.get_metrics("companies+countries", SCM)
metric = DataSource.get_metrics("organizations+countries", SCM)
else:
logging.error("SCM " + filter_name + " not supported")
return items
Expand Down
7 changes: 6 additions & 1 deletion vizgrimoire/data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,9 @@ def convert_all_to_single(cls, data, filter_, destdir, evolutionary, period='mon
if 'mailing_list_url' in data.keys():
data['name'] = data.pop('mailing_list_url')
data['name'] = [item.replace('/', '_') for item in data['name']]
if cls == ITS or cls == SCM:
if filter_.get_name() == "company+country":
data['name'] = data.pop('filter')

if not evolutionary:
# First create the JSON with the list of items
Expand All @@ -540,12 +543,14 @@ def convert_all_to_single(cls, data, filter_, destdir, evolutionary, period='mon
createJSON(item_list, fn)
# Items files
ts_fields = ['unixtime','id','date',period]
# Not metrics fields
no_metrics_fields = ['filter_type']
for i in range(0,len(data['name'])):
item_metrics = {}
item = data['name'][i]
for metric in data:
if metric == "name": continue
if metric in ts_fields: continue
if metric in ts_fields+no_metrics_fields: continue
if len(data[metric])<len(data['name']):
logging.error(cls.get_name()+" "+metric + " not supported in GROUP BY. Not included")
continue
Expand Down
2 changes: 1 addition & 1 deletion vizgrimoire/metrics/query_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def get_group_field (ds_query, filter_type):
elif ds_query == SCRQuery: field = "t.url"
elif ds_query == MLSQuery: field = "ml.mailing_list_url"
elif analysis == "company"+MetricFilters.DELIMITER+"country":
field = "CONCAT(com.name,'_',cou.name)"
field = "CONCAT(org.name,'_',cou.name)"

return field

Expand Down
5 changes: 2 additions & 3 deletions vizgrimoire/metrics/scm_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ def _get_sql_generic(self, evolutionary, islist = False, days = 180):
query += " group by pup.uuid "
query += " order by last_activity desc "

print query
return query

def get_agg(self):
Expand Down Expand Up @@ -1076,7 +1075,7 @@ class CompaniesCountries(Metrics):

id = "organizations+countries"
name = "Countries"
desc = "Countries in Companies participating in the source code management system"
desc = "Organizations per Countries participating in the source code management system"
data_source = SCM

def get_list(self):
Expand All @@ -1091,7 +1090,7 @@ def get_list(self):
identities_db+".organizations org, "+identities_db+".enrollments enr "+\
"WHERE pup.people_id = s."+rol+"_id AND "+\
" pup.uuid = pro.uuid and "+\
" pro.country_code = cou.uuid and "+\
" pro.country_code = cou.code and "+\
" pup.uuid = enr.uuid and "+\
" enr.organization_id = org.id and "+\
" s.author_date >= enr.start and s.author_date < enr.end and "+\
Expand Down

0 comments on commit 61499c8

Please sign in to comment.