Merge pull request #29 from Retrospring/feature-discover

Only show new users that have asked at least 1 question (Discover)
This commit is contained in:
Georg G. 2015-05-15 12:14:40 +02:00
commit 64a7450b28
1 changed files with 2 additions and 2 deletions

View File

@ -1,12 +1,12 @@
class DiscoverController < ApplicationController
before_filter :authenticate_user!
def index
top_x = 10 # only display the top X items
@popular_answers = Answer.where("created_at > ?", Time.now.ago(1.week)).order(:smile_count).reverse_order.limit(top_x)
@popular_questions = Question.where("created_at > ?", Time.now.ago(1.week)).order(:answer_count).reverse_order.limit(top_x)
@new_users = User.order(:id).reverse_order.limit(top_x)
@new_users = User.where("asked_count > 0").order(:id).reverse_order.limit(top_x)
# .user = the user
# .question_count = how many questions did the user ask