def business(city, id): """Business page, shows the business, reviews and 10 recommendations.""" # Get current user if logged in user = session.get("user") user_id = user["user_id"] if user else None # Get business by city and business_id business = data.get_business(city.lower(), id) # Grab reviews reviews = data.get_reviews(city=business["city"].lower(), business_id=business["business_id"]) # Get 10 recommendations recommendations = recommender.recommend3(user_id=user_id, business_id=id, city=business["city"].lower(), n=10) # Render return render_template("business.html", business=business, recommendations=recommendations, reviews=reviews, user=user)
def user_average_score(user_id, city): """ Finds the average score a user gave to businesses in a given city. """ scores = [ review['stars'] for review in data.get_reviews(city, user_id=user_id, n=1000000000000) ] return np.mean(scores)
def display_leaderboard(): gameData = data.get_reviews() return render_template("showgames.html" , the_title="Games Table", the_data =gameData,)