Beispiel #1
0
def rank_update(po_id):
    up = vote_up_count(po_id)
    down = vote_down_count(po_id)
    po = Po.mc_get(po_id)
    _hot = hot(up, down, po.create_time)
    _confidence = confidence(up, down)
    for r in Rank.where(po_id=po_id):
        r.hot = _hot
        r.confidence = _confidence
        r.save()
        mc_flush_cid(r.to_id, r.cid)
Beispiel #2
0
def rank_update(po_id):
    up = vote_up_count(po_id)
    down = vote_down_count(po_id)
    po = Po.mc_get(po_id)
    _hot = hot(up, down, po.create_time)
    _confidence = confidence(up, down)
    for r in Rank.where(po_id=po_id):
        r.hot = _hot
        r.confidence = _confidence
        r.save()
        mc_flush_cid(r.to_id, r.cid)
Beispiel #3
0
def rank_new(po, to_id, cid):
    po_id = po.id
    r = Rank(po_id=po_id, from_id=po.user_id, to_id=to_id, cid=cid)
    up = vote_up_count(po_id)
    down = vote_down_count(po_id)
    r.hot = hot(up, down, po.create_time)
    r.confidence = confidence(up, down)
    r.save()
    mc_flush_cid(to_id, cid)
    mc_rank_id_by_po_id_to_id.set('%s_%s' % (po_id, to_id), r.id)
#    mc_rank_to_id_by_po_id_cid.set('%s_%s' % (po_id, cid), to_id)
    return r
Beispiel #4
0
def rank_new(po, to_id, cid):
    po_id = po.id
    r = Rank(po_id=po_id, from_id=po.user_id, to_id=to_id, cid=cid)
    up = vote_up_count(po_id)
    down = vote_down_count(po_id)
    r.hot = hot(up, down, po.create_time)
    r.confidence = confidence(up, down)
    r.save()
    mc_flush_cid(to_id, cid)
    mc_rank_id_by_po_id_to_id.set('%s_%s' % (po_id, to_id), r.id)
    #    mc_rank_to_id_by_po_id_cid.set('%s_%s' % (po_id, cid), to_id)
    return r