Esempio n. 1
0
def get_average_items():
    tags = request.args.getlist('tags')
    averageRatings = redis_functions.get_average_ratings(
        tags, globals.MAX_ITEMS_IN_ONE_SORT)
    print averageRatings
    results = redis_functions.get_items(averageRatings)
    return jsonify(items=results, state="success")
Esempio n. 2
0
def add_item_for_user_and_return_json(user, tags, itemTitle):
    if is_adding_allowed(user, tags, itemTitle):
        itemIds = redis_functions.add_item_for_user('item:' + itemTitle, tags,
                                                    user)
        items = redis_functions.get_items(itemIds)
        return jsonify(items=items, state="success")
    return jsonify(state="error")
Esempio n. 3
0
def get_active_channels():
    tags = request.args.getlist('tags')
    active_channels = redis_functions.get_activity(tags, 3)
    results = []
    for string in active_channels:
        categories = string.split("+")
        avg = redis_functions.get_average_ratings(categories, 2)
        results.append({'tags':categories, 'items':redis_functions.get_items(avg)})
    return jsonify(channels = results, state="success")
Esempio n. 4
0
def get_active_channels():
    tags = request.args.getlist('tags')
    active_channels = redis_functions.get_activity(tags, 3)
    results = []
    for string in active_channels:
        categories = string.split("+")
        avg = redis_functions.get_average_ratings(categories, 2)
        results.append({
            'tags': categories,
            'items': redis_functions.get_items(avg)
        })
    return jsonify(channels=results, state="success")
Esempio n. 5
0
def get_user_items():
    tags = request.args.getlist('tags')
    usersRatings = redis_functions.get_users_ratings(g.uuid, tags, globals.MAX_ITEMS_IN_ONE_SORT)
    results = redis_functions.get_items(usersRatings)
    return jsonify(items = results, state="success")
Esempio n. 6
0
def get_average_items():
    tags = request.args.getlist('tags')
    averageRatings = redis_functions.get_average_ratings(tags, globals.MAX_ITEMS_IN_ONE_SORT)
    print averageRatings
    results = redis_functions.get_items(averageRatings)
    return jsonify(items = results, state="success")
Esempio n. 7
0
def add_item_for_user_and_return_json(user, tags, itemTitle):
    if is_adding_allowed(user, tags, itemTitle):
        itemIds = redis_functions.add_item_for_user('item:'+itemTitle, tags, user)
        items = redis_functions.get_items(itemIds)
        return jsonify(items = items, state="success")
    return jsonify(state="error")
Esempio n. 8
0
def get_user_items():
    tags = request.args.getlist('tags')
    usersRatings = redis_functions.get_users_ratings(
        g.uuid, tags, globals.MAX_ITEMS_IN_ONE_SORT)
    results = redis_functions.get_items(usersRatings)
    return jsonify(items=results, state="success")