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:
commit
64a7450b28
|
@ -1,12 +1,12 @@
|
||||||
class DiscoverController < ApplicationController
|
class DiscoverController < ApplicationController
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
|
|
||||||
def index
|
def index
|
||||||
top_x = 10 # only display the top X items
|
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_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)
|
@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
|
# .user = the user
|
||||||
# .question_count = how many questions did the user ask
|
# .question_count = how many questions did the user ask
|
||||||
|
|
Loading…
Reference in New Issue