Пример #1
0
def query_cassandra(topic, subreddit, year_month):
    if not year_month_checker(year_month, 2014, 5):
        flash("Ooops, you tried to get comments from an invalid month. Please try something before June 2014.", "error")
        return redirect("/")
    MAX_USERS = 10000
    MAX_COMMENTS = 20
    es_helper = ESHelper()
    top_users = es_helper.get_top_users(subreddit, year_month, MAX_USERS)
    top_filtered_comments = es_helper.get_top_comments_by_score(topic, year_month, top_users, MAX_COMMENTS)
    cassandra_helper = CassandraHelper()
    return render_template(
        "comments.html",
        topic=topic,
        comments=cassandra_helper.get_highest_ranked_comments(top_filtered_comments, year_month),
    )
Пример #2
0
def query_cassandra(topic, subreddit, year_month):
    if not year_month_checker(year_month, 2014, 5):
        flash(
            "Ooops, you tried to get comments from an invalid month. Please try something before June 2014.",
            'error')
        return redirect('/')
    MAX_USERS = 10000
    MAX_COMMENTS = 20
    es_helper = ESHelper()
    top_users = es_helper.get_top_users(subreddit, year_month, MAX_USERS)
    top_filtered_comments = es_helper.get_top_comments_by_score(
        topic, year_month, top_users, MAX_COMMENTS)
    cassandra_helper = CassandraHelper()
    return render_template(
        'comments.html',
        topic=topic,
        comments=cassandra_helper.get_highest_ranked_comments(
            top_filtered_comments, year_month))