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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user