mirror of
https://github.com/discourse/discourse-solved.git
synced 2025-07-04 12:52:17 +00:00
Follow up to #352 The user summary solutions count is more than it should be because of deleted topics and posts.
14 lines
360 B
Ruby
14 lines
360 B
Ruby
# frozen_string_literal: true
|
|
|
|
module DiscourseSolved::UserSummaryExtension
|
|
extend ActiveSupport::Concern
|
|
|
|
def solved_count
|
|
DiscourseSolved::SolvedTopic
|
|
.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
|