コード例 #1
0
def buzz_career_bind(li):
    id_list = []
    for i in li:
        if i.cid == CID_BUZZ_FOLLOW:
            id_list.append(i.rid)
    c_dict = career_dict(id_list)
    for i in li:
        if i.cid == CID_BUZZ_FOLLOW:
            i.entry.career = c_dict[i.rid]
    return li
コード例 #2
0
ファイル: buzz.py プロジェクト: xqk/42qu_github_mirror
def buzz_career_bind(li):
    id_list = []
    for i in li:
        if i.cid == CID_BUZZ_FOLLOW:
            id_list.append(i.rid)
    c_dict = career_dict(id_list)
    for i in li:
        if i.cid == CID_BUZZ_FOLLOW:
            i.entry.career = c_dict[i.rid]
    return li
コード例 #3
0
def notice_list(to_id, limit, offset):
    li = Notice.mc_get_list(notice_id_list(to_id, limit, offset))
    dic = OrderedDict()
    cls_dic = defaultdict(set)
    for i in li:
        cls_dic[Zsite].add(i.from_id)
        cls_dic[NOTICE_CLS.get(i.cid)].add(i.rid)
    from_list = cls_dic[Zsite]
    for cls, id_list in cls_dic.items():
        if cls:
            cls_dic[cls] = cls.mc_get_dict(id_list)
        else:
            cls_dic[cls] = {}
    career_dic = career_dict(from_list)
    for i in li:
        from_id = i.from_id
        if from_id:
            i.from_user = cls_dic[Zsite][from_id]
            i.from_user.career = career_dic[from_id]
        i.entry = cls_dic[NOTICE_CLS.get(i.cid)].get(i.rid)
    return li