Fix lint errors

This commit is contained in:
Karina Kwiatek 2023-11-27 22:13:56 +01:00
parent b55e6da9a5
commit 8facb44af7
2 changed files with 5 additions and 4 deletions

View File

@ -8,8 +8,8 @@ class DiscoverController < ApplicationController
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)
@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)
@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.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)
@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
# .answer_count = how many questions did the user answer
@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).
order('answer_count').
reverse_order.limit(top_x)

View File

@ -27,7 +27,8 @@ class Answer < ApplicationRecord
FROM reactions
WHERE parent_id = answers.id
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