Skip to content

Commit

Permalink
Rubocop fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtOfCode- committed Jul 19, 2017
1 parent ece6de8 commit 591defc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/models/post.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class Post < ApplicationRecord
scope(:not_autoflagged, lambda {
# I'm sorry.
left_joins(:flag_logs)
.joins("LEFT JOIN (SELECT posts.id AS 'post_id', COUNT(DISTINCT flag_logs.id) AS 'autoflag_count' FROM posts INNER JOIN flag_logs ON flag_logs.post_id = posts.id WHERE flag_logs.is_auto = 1 GROUP BY posts.id) AS flag_counts ON flag_counts.post_id = posts.id")
.joins("LEFT JOIN (SELECT posts.id AS 'post_id', COUNT(DISTINCT flag_logs.id) AS 'autoflag_count' FROM posts INNER JOIN flag_logs " \
'ON flag_logs.post_id = posts.id WHERE flag_logs.is_auto = 1 GROUP BY posts.id) AS flag_counts ON flag_counts.post_id = posts.id')
.where(flag_counts: { autoflag_count: 0 }) +
left_joins(:flag_logs).where(flag_logs: { post_id: nil })
})
Expand Down

0 comments on commit 591defc

Please sign in to comment.