discourse-solved/lib/discourse_solved/user_summary_extension.rb
Natalie Tay be5798f6d8
FIX: Standardise the definition of what a solution is (#352)
There are three locations where a user's solution query is defined
- user summary
- user card
- user directory

This PR updates the queries to use data from the new `SolvedTopics` table instead of the `UserActions` table. And adds testssssss
2025-03-28 09:49:02 +08:00

13 lines
314 B
Ruby

# frozen_string_literal: true
module DiscourseSolved::UserSummaryExtension
extend ActiveSupport::Concern
def solved_count
DiscourseSolved::SolvedTopic
.joins("JOIN posts ON posts.id = discourse_solved_solved_topics.answer_post_id")
.where(posts: { user_id: @user.id })
.count
end
end