User Summary - Most Liked By user attributions are incorrect


At for example, the “Most Liked By” column containers the correct numbers of likes and the correct users, but does not match them up correctly.

This is a little easier to see when you’re the admin for the site and can check against a data explorer query, though. I can’t easily verify it’s happened on meta, have seen the issue most clearly on my site.


Nothing special required, just visit a user summary page and check the numbers against some other source. For example using the data explorer plugin, or using the user directory in some circumstances (one of the “most liked by” for my page on my site, for example, is shown giving me more likes than he has given total on the user directory).

1 Like

Are you sure you are looking at all time interval in the user list?


For reference, I’m using the Data Explorer query detailed here as my main comparison: Data Explorer Plugin.

The query and the summary both pull the same numbers and users, but they don’t match up correctly on the summary page.


Sure @zogstrip there were some reports of weirdness with these numbers on BBS as well so this warrants a further look next week.

1 Like

AFAICT that query doesn’t take into consideration Likes that were given, then taken back (or otherwise negated).
If you run

FROM post_actions
WHERE post_action_type_id = 2
AND user_id = deleted_by_id

does the difference in the count jive?

Does it really? That’s kind of odd. Your suggested query doesn’t really give me an easy way to evaluate the difference, although maybe I’m not using it as you intended.

In any case though, thanks for looking into it, but I think it’s really unlikely that’s the issue. The set of counts and users between the query and the summary page are literally identical (and occupy a fairly wide range, they don’t differ by one or two likes), the counts are just attributed to different users on the summary page. The counts on the summary page don’t align well with my experience on the forum, either.


This occurs on FeverBee community forums.

My summary says alenarybik gave me 21 :heart: but she has only given a total of 11 :heart: to all as it says on her summary page.

@HAWK should be there instead; switch places with alenarybik.


How strange. I’d never noticed that before!

Just noticed it yesterday and assumed it was a reported bug. Aye, it be. *grin*

Addendum: It also incorrectly attributes @erlend_sh and @ccdw. Erlend only :heart: 1 post of mine, that I can recall. Chris has :heart: 9 of my posts.


We definitely need to fix this @zogstrip


Probably not excluding deleted votes or posts

1 Like

I’ve been playing with this in Data Explorer (please forgive readability issues)

WITH tl AS ( SELECT SUM(topics.like_count) AS topics_like_sum
FROM topics )
, pl AS ( SELECT SUM(posts.like_count) AS posts_like_sum
FROM posts )
, pal AS ( SELECT COUNT( AS pa_like_count 
FROM post_actions 
WHERE post_actions.post_action_type_id = 2 )
, padl AS ( SELECT COUNT( AS deleted_pa_like_count 
FROM post_actions 
WHERE post_actions.post_action_type_id = 2
AND post_actions.deleted_at IS NOT NULL )
, bpl AS ( SELECT SUM(badge_posts.like_count) AS bp_like_sum
FROM badge_posts )
, pcl AS ( SELECT SUM(topics.like_count) AS priv_topic_like_sum 
FROM topics 
JOIN categories 
ON topics.category_id = 
WHERE categories.read_restricted )
  , pl.posts_like_sum
  , pal.pa_like_count
  , padl.deleted_pa_like_count
  , bpl.bp_like_sum
  , pcl.priv_topic_like_sum
  , pl 
  , pal
  , padl
  , bpl
  , pcl

For my test site I get

topics_like_sum  	508
posts_like_sum 	 	506
pa_like_count 	 	513
deleted_pa_like_count 	7
bp_like_sum 	 	470
priv_topic_like_sum 	32

513 - 7 = 506 which looks good.
and 470 + 32 + 7 is close
But I’m not seeing how Topic Likes and Posts Likes would differ.
* could be because I run rails s and sidekiq separately

1 Like

Thanks for reporting this issue @Yuun.
Thanks @purldator for providing more evidences.
Thanks @Mittineague for investigating.

Here’s a fix :kissing_heart:


Thanks for looking into it @zogstrip!

The numbers are slightly different now, looks like they are taking into account deleted/negated likes correctly, but the count-user matches are still incorrect on my site. This shouldn’t require a rebuild or a sidekiq job I need to wait for, right?

As an off-topic follow-up

The difference has to do with 2 “parent” categories that do not have any Create Read Reply permissions but are used only to hold sub-categories.

That pesky LikerGuy1 Liked the “About the” posts for those no-replies “topics”.


Would you mind telling me more?

1 Like

Not at all, let me use my summary here as an example:

This says my posts are most liked by sam at 45, with yourself at 14. This doesn’t really match with my experience here, where you are a much more prolific user of the like button. :wink:

To check, if I go to my Likes Received notification page, by hand I count:

zogstrip: 45 likes
sam: 14 likes

On my site, the summary page says a user has liked my posts 211 likes, whereas according to the user directory and that user’s own summary page, they’ve only given 136 likes total.


Hmm so maybe the names are wrong? Somehow Sam is appearing where Regis should? Thanks for your persistence with helping us in this @yuun.


Thanks :thumbsup: I know what’s happening. Will fix. It’s now fixed :wink:


A correction is in order (as embarrassing as it s after Likes)
It should teach me to more thoroughly test before posting results.

Anyway, I decided to repro and had LikerGal1 Like the same parent Cat OPs .
No repro, :frowning:

Being a comparatively small localhost forum a lot of numbers have not diverged greatly and I looked for other “two occurrences events” that might be involved.

LikerGuy1 had also Liked 2 “hidden by Flags” posts.
LikerGal1 did similar, - No repro, :frowning:

LikerGuy1 had also Liked 2 posts made by anonymous-mode members that were subsequently deleted by a Mod
LikerGal1 did the same - repro !!

Was it because the posts had been made in anonymous-mode?
A friendly member made a test post. Another Liked it, then it was Mod deleted. - repro !!

So unfortunately this isn’t as edge case as a topic-less category getting a Like.
It seems that Liking any post that is subsequently deleted will decrement the post like count, but will not decrement the associated topics like count.

Still a bit edge case I suppose, but maybe worth looking into if topic like count is used in value weighting algorithms.