Let’s slide this over to community to get more eyes on it. ![]()
Though the query isn’t counting Likes properly, or at least not all of ours (possibly because we’ve turned Reactions on mid-flow)
| reaction | posts | count |
|---|---|---|
| 52295 | 144915 | |
| 1167 | 1224 | |
| 1101 | 1236 |
versus:
| reaction_value | count |
|---|---|
| 1371442 | |
| 1236 | |
| 1224 |
FWIW I've been using a small variation of this one to produce our table:
SELECT source.reaction_value,
count
FROM
(
(
SELECT
CASE WHEN post_action_type_id = 2 THEN 'heart' END AS reaction_value,
COUNT(*) AS count
FROM post_actions
WHERE post_action_type_id = 2
AND deleted_at IS NULL
GROUP BY 1
)
UNION ALL
(
SELECT
reaction_value,
SUM(reaction_users_count) AS count
FROM discourse_reactions_reactions
WHERE reaction_value <> 'heart'
GROUP BY 1
)
) AS source
GROUP BY 1,2
ORDER BY 2 DESC
There’s also the stock one in the reports section too to cross-check (but the table isn’t as easy to copy and paste
) - /admin/reports/reactions