 # USER CODE CELLS COUNTS AND DISTRIBUTIONS
 #IN MEtrics Reporting
 create or replace view metrics_reporting.user_code_cell_counts as
-select wc.username, sum(code_cells_count) as user_code_cells_count
+select wc.username, ui.user_id,
+sum(code_cells_count) as user_code_cells_count
 from metrics_reporting.workspaces_current wc
 inner join metrics.user_info ui on ui.username = wc.username
 where ui.kb_internal_user = 0

select count(*) as total_app_run_cnt, 
IFNULL(uau.app_name,'not specified') as app_name,
uau.func_name,
uau.username, ui.kb_internal_user
from metrics.user_info ui 
inner join metrics.user_app_usage uau
on ui.username = uau.username

create or replace view metrics_reporting.app_category_run_counts_by_user as
select count(*) as total_app_run_cnt, 
IFNULL(acm.app_category,'unable to determine') as app_category,
uau.username, ui.user_id, ui.kb_internal_user
from metrics.user_info ui 
inner join metrics.user_app_usage uau
on ui.username = uau.username
