コード例 #1
0
def is_winner(face):
    # check if the passed face_id is the same of the winner.
    is_current_winner = (face.get(_FACE_ID) == get_from_cache('winner_id'))
    if not is_current_winner:
        return face.get('score', 0) > get_from_cache('winner_score')
    return True
コード例 #2
0
def get_current_winner(from_cache=True):
    if not from_cache:
        global FacePictures
        return FacePictures.find_one(sort={'score': -1}, limit=1)
    return get_from_cache('winner')