Example #1
0
def update_karmas():
    for pair in to_update():
        user = Account._byID(pair[0], True)
        sr = Subdigg._byID(pair[1], True)

        print user.name, sr.name
        user.incr_karma('comment', sr, 20)
Example #2
0
def normalized_hot_cached(sr_ids):
    """Fetches the hot lists for each subdigg, normalizes the scores,
    and interleaves the results."""
    results = []
    srs = Subdigg._byID(sr_ids, data = True, return_dict = False)
    for sr in srs:
        items = only_recent(get_hot(sr))

        if not items:
            continue

        top_score = max(max(x._hot for x in items), 1)
        if items:
            results.extend((l, l._hot / top_score) for l in items)

    results.sort(key = lambda x: (x[1], x[0]._hot), reverse = True)
    return [l[0]._fullname for l in results]