示例#1
0
def main(request):
    if request.user.is_anonymous():
        request.unique_user.make_unique('vue')

    if not 'rater_class' in request.session:
        from .rater import VueRater
        request.session['rater_class'] = VueRater
    
    vue_recommendations = vue.get_vue_recommendations(request.unique_user)
    similar_debug = getattr(vue_recommendations, 'similar_debug', ())
    all_recommendations = get_top(vue.get_all_recommendations(request.unique_user))
    vue_recommendations = get_top(vue_recommendations)
    
    vue_rater = request.session['rater_class']( request )
    rated_movies = len( vue_rater.get_rated_films() )
    movies_to_rate = 15 - rated_movies
    rating_progress = ( rated_movies * 100 ) / 15

    context = {
            'all_recommendations': all_recommendations,
            'vue_recommendations': vue_recommendations,
            'similar_debug': similar_debug,
            'moods': vue.MOODS,
            'rating_progress': rating_progress,
            'movies_to_rate': movies_to_rate,
            'rated_movies': rated_movies,
            }

    return render(request, 'vue/index.html', context)
示例#2
0
 def get_recommendations(self, mood):
     return vue.get_all_recommendations(self.request.unique_user, mood)