Esempio n. 1
0
def get_partner_list(geog,id, partners):
    sql = shared_sql.get_partners_sql(geog,id)
    if(sql):
        part_list = run_query(sql)
        if(not partners or len(part_list) == 1):
            return part_list
        filtered_partners = [x['id'] for x in part_list if str(x['id']) in partners]
        if not filtered_partners:
            return part_list
        for partner in part_list:
            if partner['id'] not in filtered_partners:
                partner['unmarked'] = 1
        return part_list
    else:
        return {}
Esempio n. 2
0
def get_partner_list(geog, id, partners):
    sql = shared_sql.get_partners_sql(geog, id)
    if (sql):
        part_list = run_query(sql)
        if (not partners or len(part_list) == 1):
            return part_list
        filtered_partners = [
            x['id'] for x in part_list if str(x['id']) in partners
        ]
        if not filtered_partners:
            return part_list
        for partner in part_list:
            if partner['id'] not in filtered_partners:
                partner['unmarked'] = 1
        return part_list
    else:
        return {}
Esempio n. 3
0
def get_partner_list(geog, id, partners):
    sql = shared_sql.get_partners_sql(geog, id)
    if(sql):
        part_list = run_query(sql)
        filtered_partners = [x['partner_id'] for x in part_list]
        coco_partners = Partner.objects.values_list('id', 'partner_name', 'full_partner_name').order_by('partner_name')
        partner_list = []
        for id, partner_name, full_partner_name in coco_partners:
            partner_dict = {'partner_id': id, 'PARTNER_NAME': partner_name, 'FULL_PARTNER_NAME': full_partner_name}
            if partners:
                if str(id) not in partners:
                    partner_dict['unmarked'] = 1
            if id in filtered_partners:
                partner_dict['highlight'] = 1
            partner_list.append(partner_dict)
        return partner_list
    else:
        return {}
Esempio n. 4
0
def get_partner_list(geog, id, partners):
    sql = shared_sql.get_partners_sql(geog, id)
    if(sql):
        part_list = run_query(sql)
        filtered_partners = [x['partner_id'] for x in part_list]
        coco_partners = Partner.objects.values_list('id', 'partner_name').order_by('partner_name')
        partner_list = []
        for id, partner_name in coco_partners:
            partner_dict = {'partner_id': id, 'PARTNER_NAME': partner_name}
            if partners:
                if str(id) not in partners:
                    partner_dict['unmarked'] = 1
            if id in filtered_partners:
                partner_dict['highlight'] = 1
            partner_list.append(partner_dict)
        return partner_list
    else:
        return {}