dev_trainings
daiao 6 years ago
parent 09eed36ec6
commit 82295eef81

@ -74,11 +74,9 @@ class ShixunsService
discusses = Discuss.limit(LIMIT).where(:dis_id => dis_id, :dis_type => dis_type, discusses = Discuss.limit(LIMIT).where(:dis_id => dis_id, :dis_type => dis_type,
:root_id => nil).includes(:user, :praise_tread).offset(offset) :root_id => nil).includes(:user, :praise_tread).offset(offset)
else else
disscusses = Discuss.where("dis_id = :dis_id and dis_type = :dis_type and root_id = :root_id and disscusses = Discuss.where("dis_id = :dis_id and dis_type = :dis_type and root_id is null and
(hidden = :hidden or user_id = :user_id)", (hidden = :hidden or user_id = :user_id)",
{dis_id: dis_id, dis_type: dis_type, root_id: nil, hidden: false, {dis_id: dis_id, dis_type: dis_type, hidden: false, user_id: current_user.id})
user_id: current_user.id})
disscuss_count = disscusses.count disscuss_count = disscusses.count
discusses = disscusses.limit(LIMIT).includes(:user, :praise_tread).offset(offset) discusses = disscusses.limit(LIMIT).includes(:user, :praise_tread).offset(offset)
end end

Loading…
Cancel
Save