def get_unsigned_projects_for_company(company_id): """ Returns a list of projects that the company has not signed a CCLA for. :param company_id: The company's ID. :type company_id: string :return: dict representation of the projects object. :rtype: [dict] """ # Verify company is valid company = Company() try: company.load(company_id) except DoesNotExist as err: return {'errors': {'company_id': str(err)}} # get project ids that the company has signed the CCLAs for. signature = Signature() # signed_project_ids = signature.get_projects_by_company_signed(company_id) signed_project_ids = signature.get_projects_by_company_signed(company_id) # from all projects, retrieve projects that are not in the signed project ids # Consider adding attributes_to_get for the projection # unsigned_projects = [project for project in Project().all(attributes_to_get=['project_id']) unsigned_projects = [project for project in Project().all() if project.get_project_id() not in signed_project_ids] # filter to get unsigned projects that are not of ccla type ccla_unsigned_projects = [project.to_dict() for project in unsigned_projects if project.get_project_ccla_enabled()] return ccla_unsigned_projects
def get_unsigned_projects_for_company(company_id): """ Returns a list of projects that the company has not signed a CCLA for. :param company_id: The company's ID. :type company_id: string :return: dict representation of the projects object. :rtype: [dict] """ # Verify company is valid company = Company() try: company.load(company_id) except DoesNotExist as err: return {'errors': {'company_id': str(err)}} # get project ids that the company has signed the CCLAs for. signature = Signature() signed_project_ids = signature.get_projects_by_company_signed(company_id) # from all projects, retrieve projects that are not in the signed project ids unsigned_projects = [ project.to_dict() for project in Project().all() if project.get_project_id() not in signed_project_ids ] return unsigned_projects