استعلامات الشارات باستخدام جدول "badge_posts" لا تُمنح للفئات غير العامة

كان لدى أحد مستخدمينا 5 شارات “رد لطيف” (أعجب بـ 100 منشور وأعطى 100 إعجاب). ثم قمنا بنقل بعض المواضيع إلى فئة خاصة، وأصبح لديه الآن 3 شارات فقط. يبدو أن استعلام الشارة لا يحسب الإعجابات المقدمة أو المستلمة في المواضيع المنقولة، ربما بسبب نقلها أو ربما لأنها أصبحت خاصة الآن.

أثناء تصحيح هذا الخطأ، قمت بنسخ استعلام الشارة إلى مستكشف البيانات:

select p.user_id, p.id post_id, current_timestamp granted_at
from badge_posts p
where p.post_number > 1
and p.like_count >= 10

يعيد الاستعلام أعلاه 3 نتائج فقط للمستخدم، بينما كان يجب أن يكون العدد 5. لاحظت أنه يستخدم جدول “badge_posts”. لا يمكنني العثور على جدول “badge_posts” في عرض شجرة مستكشف البيانات. لذا قمت بتغيير “badge_posts” إلى “posts”، وعاد ليعيد 5 نتائج كما هو متوقع.

من أين يأتي جدول “badge_posts”، وهل يجب ألا يستخدم استعلام الشارة جدول “posts” بدلاً من ذلك؟

That table confused me for a long time. It is defined here: discourse/lib/badge_posts_view_manager.rb at main · discourse/discourse · GitHub. It is a postgres view. My understanding of a view is that it is a name that is assigned to a query.

Posts in the badge_posts view are visible posts that are not in read restricted categories. When you moved your topics to a private category, you removed their posts from the badge_posts view.

Our private category is not all that private- you just have to accept a policy to gain access. So I would like to include posts from that category. I guess I would need to create a custom badge that looks similar to Nice Reply (and Good Reply and Great Reply), but use posts instead of badge_posts.