Le query sui badge che utilizzano la tabella "badge_posts" non vengono assegnate per le categorie non pubbliche

Uno dei nostri utenti aveva 5 distintivi “Risposta gradita” (ha ricevuto 100 like e ne ha inviati 100). Poi abbiamo spostato alcuni argomenti in una categoria privata e ora ne ha solo 3. Sembra che la query dei distintivi non conti i like ricevuti o inviati sugli argomenti spostati, forse perché sono stati spostati o forse perché ora sono privati.

Nel debug di questo problema, ho copiato la query dei distintivi in Data Explorer:

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

La query sopra restituisce solo 3 risultati per l’utente, ma dovrebbero essere 5. Ho notato che utilizza la tabella “badge_posts”. Non riesco a trovare la tabella badge_posts nella visualizzazione ad albero di Data Explorer. Quindi ho sostituito “badge_posts” con “posts” e ora restituisce 5 come previsto.

Da dove proviene la tabella “badge_posts” e la query dei distintivi non dovrebbe utilizzare invece la tabella “posts”?

1 Mi Piace

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.

6 Mi Piace

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.

2 Mi Piace

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.