def _update_suggestions(self, avatar): for category, score in get_category_scores(avatar).iteritems(): if score < SUGGESTION_MIN_SCORE: continue #print 'Suggest category for %r: %r (%.03f)' % (avatar, category, score) redis_suggestions.suggest(avatar, 'category', category.getId(), score)
def category_suggestions(): if not redis_write_client: return while True: user_id = next_scheduled_check() if user_id is None: break user = User.get(int(user_id)) if user: for category, score in get_category_scores(user).iteritems(): if score < SUGGESTION_MIN_SCORE: continue logger.debug('Suggesting {} with score {:.03} for {}'.format(category, score, user)) suggest(user, 'category', category.getId(), score) unschedule_check(user_id)
def category_suggestions(): if not redis_write_client: return while True: user_id = next_scheduled_check() if user_id is None: break user = User.get(int(user_id)) if user: for category, score in get_category_scores(user).iteritems(): if score < SUGGESTION_MIN_SCORE: continue logger.debug('Suggesting %s with score %.03f for %s', category, score, user) suggest(user, 'category', category.getId(), score) unschedule_check(user_id)