Пример #1
0
def get_judgment():
    movie_id = request.args.get('movie_id')

    judgy, prediction = model.judgment(session['user_id'], movie_id)

    if prediction:
        prediction = model.rounding(prediction)

    return render_template("ajaxy.html", prediction=prediction, judgy=judgy)
Пример #2
0
def get_judgment():
    if session.get('user_id'):
        movie_id = request.args.get('movie_id')

        judgy, prediction = model.judgment(session['user_id'], movie_id)

        if prediction:
            prediction = model.rounding(prediction)

        return render_template("ajaxy.html", prediction=prediction, judgy=judgy)
    else:
        return "Register to see what the eye has to say about your taste in movies!"
Пример #3
0
def show_movie(movie_id):
    ratings = model.get_ratings_for_movie(movie_id)
    movie_object = model.get_movie(movie_id)

    all_sum = 0
    count = 0
    for rating in ratings:
        all_sum += rating.rating
        count += 1

    avg = float(all_sum)/count

    avg = model.rounding(avg)

    rated = model.get_rating_movie_user(session['user_id'], movie_id)

    return render_template("movie.html", avg=avg, movie_object=movie_object, rated=rated)