def get_project_roles(pjid, args, role, flag_total): projects_id = store.get_all_projects_id() if pjid not in projects_id: return [] else: if not flag_total and not detect_project_repositories_overlap(projects_id[pjid], args): return [] if role == "softwaredeveloper": tmp_arg = args if not flag_total: pr_temp_frame = store.get_project_temporal_frame(projects_id[pjid]) tmp_arg['begin'] = pr_temp_frame.get('first_commit') tmp_arg['end'] = pr_temp_frame.get('last_commit') co, res = app.request_view('project-developers', pjid=pjid, **tmp_arg) return res else: res = set() users_id = store.get_all_members(role) for x in users_id: pr_res = store.get_all_member_projects(x) if projects_id[pjid] in pr_res: res.add(x) res_set = [] [res_set.append({ 'id': store.db.hgetall(x).get("id"), 'uri': x }) for x in res] return res_set
def helper_get_position_developers(uid, position, **kwargs): flag_total = kwargs.get('begin') is None and kwargs.get('end') is None args = get_correct_kwargs(kwargs) try: res = set() pr = get_position_products(uid, args, position, flag_total) devs = map(lambda k: app.request_view('product-developers', prid=k.get('id'), **kwargs), pr) [[res.add(j.get('uri')) for j in x] for x in map(lambda x: x[1], devs)] res_devs = [] [res_devs.append({ "id": store.db.hgetall(x).get("id"), "uri": x }) for x in res] return args, res_devs except (EnvironmentError, AttributeError) as e: raise APIError(e.message) return args, []