1
0
mirror of synced 2026-08-04 17:27:04 +00:00

FIX: Exclude deleted topics and posts as solution in user summary (#358)

Follow up to #352

The user summary solutions count is more than it should be because of deleted topics and posts.
This commit is contained in:
Natalie Tay
2025-04-04 16:43:00 +08:00
committed by GitHub
parent e2a09417a2
commit 37003f91ef
2 changed files with 33 additions and 3 deletions
@@ -5,8 +5,9 @@ module DiscourseSolved::UserSummaryExtension
def solved_count
DiscourseSolved::SolvedTopic
.joins("JOIN posts ON posts.id = discourse_solved_solved_topics.answer_post_id")
.where(posts: { user_id: @user.id })
.joins(answer_post: :user, topic: {})
.where(posts: { user_id: @user.id, deleted_at: nil })
.where(topics: { archetype: Archetype.default, deleted_at: nil })
.count
end
end