Beispiel #1
0
def _set_user_to_regroup_dict(regroup_dict):

    regions = regroup_dict['region']
    region_groups = regroup_dict['region_group']

    region_group_user_email = defaultdict(set)
    for region_group_id in region_groups:
        user_ids = user_base.get_director_ids_by_area(region_group_ids=[region_group_id, ])
        profiles = user_base.mget_profile(user_ids)
        region_group_user_email[region_group_id].update(set([profile.email for profile in profiles]))

    region_user_email = defaultdict(set)
    for region_id in regions:
        user_ids = user_base.get_director_ids_by_area(region_ids=[region_id, ])
        profiles = user_base.mget_profile(user_ids)
        region_user_email[region_id].update(set([profile.email for profile in profiles]))

    # 重组
    for region_group_id, rst_list in region_groups.iteritems():
        region_groups[region_group_id] = {
            "rst_list": rst_list,
            "email_list": region_group_user_email.get(region_group_id)
        }
    for region_id, rst_list in regions.iteritems():
        regions[region_id] = {
            "rst_list": rst_list,
            "email_list": region_user_email.get(region_id)
        }
Beispiel #2
0
def _set_user_to_regroup_dict(regroup_dict):

    regions = regroup_dict['region']
    region_groups = regroup_dict['region_group']

    region_group_user_email = defaultdict(set)
    for region_group_id in region_groups:
        user_ids = user_base.get_director_ids_by_area(region_group_ids=[
            region_group_id,
        ])
        profiles = user_base.mget_profile(user_ids)
        region_group_user_email[region_group_id].update(
            set([profile.email for profile in profiles]))

    region_user_email = defaultdict(set)
    for region_id in regions:
        user_ids = user_base.get_director_ids_by_area(region_ids=[
            region_id,
        ])
        profiles = user_base.mget_profile(user_ids)
        region_user_email[region_id].update(
            set([profile.email for profile in profiles]))

    # 重组
    for region_group_id, rst_list in region_groups.iteritems():
        region_groups[region_group_id] = {
            "rst_list": rst_list,
            "email_list": region_group_user_email.get(region_group_id)
        }
    for region_id, rst_list in regions.iteritems():
        regions[region_id] = {
            "rst_list": rst_list,
            "email_list": region_user_email.get(region_id)
        }
Beispiel #3
0
def _get_user_profile(user_ids):
    user_profiles = user_service.mget_profile(user_ids)
    return {user_profile.user_id: user_profile for user_profile in user_profiles}
Beispiel #4
0
def _get_user_profile(user_ids):
    user_profiles = user_service.mget_profile(user_ids)
    return {
        user_profile.user_id: user_profile
        for user_profile in user_profiles
    }