favgroups: convert post_ids from string to array.

This commit is contained in:
evazion
2020-01-14 23:33:55 -06:00
parent eecd9a183d
commit ab325c5d2b
25 changed files with 141 additions and 288 deletions

View File

@@ -450,24 +450,12 @@ class PostQueryBuilder
relation = relation.joins("JOIN (#{pool_posts.to_sql}) pool_posts ON pool_posts.post_id = posts.id").order("pool_posts.pool_index ASC")
end
if q[:favgroups_neg].present?
q[:favgroups_neg].each do |favgroup_rec|
favgroup_id = favgroup_rec.to_i
favgroup = FavoriteGroup.where("favorite_groups.id = ?", favgroup_id).first
if favgroup
relation = relation.where.not("posts.id": favgroup.post_id_array)
end
end
q[:favgroups_neg].to_a.each do |favgroup|
relation = relation.where.not("posts.id": favgroup.post_ids)
end
if q[:favgroups].present?
q[:favgroups].each do |favgroup_rec|
favgroup_id = favgroup_rec.to_i
favgroup = FavoriteGroup.where("favorite_groups.id = ?", favgroup_id).first
if favgroup
relation = relation.where("posts.id": favgroup.post_id_array)
end
end
q[:favgroups].to_a.each do |favgroup|
relation = relation.where("posts.id": favgroup.post_ids)
end
if q[:upvote].present?