Fix lint errors
This commit is contained in:
parent
b55e6da9a5
commit
8facb44af7
|
@ -8,8 +8,8 @@ class DiscoverController < ApplicationController
|
||||||
|
|
||||||
top_x = 10 # only display the top X items
|
top_x = 10 # only display the top X items
|
||||||
|
|
||||||
@popular_answers = Answer.for_user(current_user).where("created_at > ?", Time.now.ago(1.week)).order(:smile_count).reverse_order.limit(top_x).includes(:question, :user, :comments)
|
@popular_answers = Answer.for_user(current_user).where("created_at > ?", Time.now.utc.ago(1.week)).order(:smile_count).reverse_order.limit(top_x).includes(:question, :user, :comments)
|
||||||
@most_discussed = Answer.for_user(current_user).where("created_at > ?", Time.now.ago(1.week)).order(:comment_count).reverse_order.limit(top_x).includes(:question, :user, :comments)
|
@most_discussed = Answer.for_user(current_user).where("created_at > ?", Time.now.utc.ago(1.week)).order(:comment_count).reverse_order.limit(top_x).includes(:question, :user, :comments)
|
||||||
@popular_questions = Question.where("created_at > ?", Time.now.ago(1.week)).order(:answer_count).reverse_order.limit(top_x).includes(:user)
|
@popular_questions = Question.where("created_at > ?", Time.now.ago(1.week)).order(:answer_count).reverse_order.limit(top_x).includes(:user)
|
||||||
@new_users = User.where("asked_count > 0").order(:id).reverse_order.limit(top_x).includes(:profile)
|
@new_users = User.where("asked_count > 0").order(:id).reverse_order.limit(top_x).includes(:profile)
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class DiscoverController < ApplicationController
|
||||||
# .user = the user
|
# .user = the user
|
||||||
# .answer_count = how many questions did the user answer
|
# .answer_count = how many questions did the user answer
|
||||||
@users_with_most_answers = Answer.select('user_id, COUNT(*) AS answer_count').
|
@users_with_most_answers = Answer.select('user_id, COUNT(*) AS answer_count').
|
||||||
where("created_at > ?", Time.now.ago(1.week)).
|
where("created_at > ?", week_ago).
|
||||||
group(:user_id).
|
group(:user_id).
|
||||||
order('answer_count').
|
order('answer_count').
|
||||||
reverse_order.limit(top_x)
|
reverse_order.limit(top_x)
|
||||||
|
|
|
@ -27,7 +27,8 @@ class Answer < ApplicationRecord
|
||||||
FROM reactions
|
FROM reactions
|
||||||
WHERE parent_id = answers.id
|
WHERE parent_id = answers.id
|
||||||
AND parent_type = 'Answer'
|
AND parent_type = 'Answer'
|
||||||
AND user_id = #{current_user.id}) as has_reacted")
|
AND user_id = #{current_user.id}) as has_reacted",
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
SHORT_ANSWER_MAX_LENGTH = 640
|
SHORT_ANSWER_MAX_LENGTH = 640
|
||||||
|
|
Loading…
Reference in New Issue