FEATURE: Show number of accepted answers on user card (#154)

FEATURE: Show number of accepted answers on user card (#154)

diff --git a/assets/javascripts/discourse/connectors/user-card-metadata/accepted-answers.hbs b/assets/javascripts/discourse/connectors/user-card-metadata/accepted-answers.hbs
new file mode 100644
index 0000000..aad64ea
--- /dev/null
+++ b/assets/javascripts/discourse/connectors/user-card-metadata/accepted-answers.hbs
@@ -0,0 +1,6 @@
+{{#if user.accepted_answers}}
+  <h3>
+    <span class="desc">{{i18n "solutions"}}</span>
+    {{user.accepted_answers}}
+  </h3>
+{{/if}}
diff --git a/assets/stylesheets/solutions.scss b/assets/stylesheets/solutions.scss
index d505d1b..651c3d9 100644
--- a/assets/stylesheets/solutions.scss
+++ b/assets/stylesheets/solutions.scss
@@ -70,3 +70,7 @@ $solved-color: green;
 aside.quote .title.title-only {
   padding: 12px;
 }
+
+.user-card-metadata-outlet.accepted-answers {
+  display: inline-block;
+}
diff --git a/plugin.rb b/plugin.rb
index d30a891..75d3d92 100644
--- a/plugin.rb
+++ b/plugin.rb
@@ -687,6 +687,14 @@ SQL
     }
   end
 
+  add_to_serializer(:user_card, :accepted_answers) do
+    Post
+      .where(user: User.find_by_username('bar3'))
+      .joins(:_custom_fields)
+      .where(_custom_fields: { name: 'is_accepted_answer', value: 'true' })
+      .count
+  end
+
   class ::Topic
     attr_accessor :accepted_answer_user_id
   end

GitHub sha: fafa1c22b0b6be369fd703f737776111f34b2569

This commit appears in #154 which was approved by eviltrout. It was merged by nbianca.