Example #1
0
def get_rating_by_user(user_id):
    user = User.query.filter_by(id=user_id).first_or_404()
    response_list = list()
    results = Rating.query_rating_by_user(user_id)
    app.logger.debug('Rating: {}'.format(results))
    if results:
        for result in results:
            response_list.append({
                'Cost': result.cost,
                'Food': result.food,
                'Service': result.service,
                'Cleanliness': result.cleanliness,
                'Total_score': result.total_score,
                'Restaurant_name': result.name,
                'Restaurant_category': result.category,
                'Address': result.address,
                'City': result.city,
                'State': result.state,
                'Restaurant_id': result.restaurant_id
            })
    return jsonify(response_list)