[Tests] Remove note_count

This commit is contained in:
Earlopain 2022-09-29 12:49:15 +02:00
parent cfba9a7861
commit 8a6fb57cc2
No known key found for this signature in database
GPG Key ID: 6CFB948E15246897
3 changed files with 0 additions and 23 deletions

View File

@ -1488,14 +1488,6 @@ class Post < ApplicationRecord
relation
end
def with_note_stats
relation = left_outer_joins(:notes).group(:id).select("posts.*")
relation = relation.select("COUNT(notes.id) AS note_count")
relation = relation.select("COUNT(notes.id) FILTER (WHERE notes.is_active = TRUE) AS active_note_count")
relation = relation.select("COUNT(notes.id) FILTER (WHERE notes.is_active = FALSE) AS deleted_note_count")
relation
end
def with_flag_stats
relation = left_outer_joins(:flags).group(:id).select("posts.*")
relation = relation.select("COUNT(post_flags.id) AS flag_count")

View File

@ -1,7 +1,6 @@
class Tag < ApplicationRecord
COUNT_METATAGS = %w[
comment_count
note_count
flag_count
child_count
pool_count

View File

@ -1674,20 +1674,6 @@ class PostTest < ActiveSupport::TestCase
assert_tag_match([posts[1]], "noter:none")
end
should "return posts for the note_count:<N> metatag" do
posts = FactoryBot.create_list(:post, 3)
FactoryBot.create(:note, post: posts[0], is_active: true)
FactoryBot.create(:note, post: posts[1], is_active: false)
assert_tag_match([posts[1], posts[0]], "note_count:1")
assert_tag_match([posts[0]], "active_note_count:1")
assert_tag_match([posts[1]], "deleted_note_count:1")
assert_tag_match([posts[1], posts[0]], "notes:1")
assert_tag_match([posts[0]], "active_notes:1")
assert_tag_match([posts[1]], "deleted_notes:1")
end
should "return posts for the description:<text> metatag" do
posts = FactoryBot.create_list(:post, 2)
posts[0].update_attribute(:description, 'abc')