FIX: CategoryTagStat queries need to exclude PMs with tags
This commit is contained in:
parent
fdd8ce9722
commit
991dfadad7
|
@ -10,6 +10,7 @@ module Jobs
|
|||
INNER JOIN topic_tags ON tags.id = topic_tags.tag_id
|
||||
INNER JOIN topics ON topics.id = topic_tags.topic_id
|
||||
AND topics.deleted_at IS NULL
|
||||
AND topics.category_id IS NOT NULL
|
||||
GROUP BY tags.id, topics.category_id
|
||||
SQL
|
||||
end
|
||||
|
|
|
@ -50,7 +50,9 @@ class CategoryTagStat < ActiveRecord::Base
|
|||
topics.category_id as category_id
|
||||
FROM tags
|
||||
INNER JOIN topic_tags ON tags.id = topic_tags.tag_id
|
||||
INNER JOIN topics ON topics.id = topic_tags.topic_id AND topics.deleted_at IS NULL
|
||||
INNER JOIN topics ON topics.id = topic_tags.topic_id
|
||||
AND topics.deleted_at IS NULL
|
||||
AND topics.category_id IS NOT NULL
|
||||
GROUP BY tags.id, topics.category_id
|
||||
) x
|
||||
WHERE stats.tag_id = x.tag_id
|
||||
|
|
Loading…
Reference in New Issue