What determines the order of frequent poster icons in the topic list?


#1

TL;DR: Anyone able to enlighten me on how the frequent poster icons - presented between the ‘original poster’ (left) and ‘most recent poster’ (far right) in post listings - are exactly chosen including their order-determinants?

What exactly determines 1) their presence, and 2) their order?


The following I understand from the tooltips, when hoovering over the users’ icon-column icons in a topic listing (and cross-referencing this with what is actually present in the topics itself):

  • Original (first) poster is presented to the far left.
  • Most recent poster presented to the far right (unless it regards the original poster then it is signaled by a blue “glow” around its icon).
  • User icons in between are “frequent posters”.

So far so good, however; the icons “in between” (the frequent posters) seem fairly randomly chosen. As in: they are not always the most frequent posters, nor are they presented in chronological order.

What am I missing here (what is the logic behind the presentation)?


(Mittineague) #2

I looked a bit for the “featured” ranking algorithm but gave up looking for now.

Using Topic Ratings Plugin as an example

The avatars are

angus - Original Poster, Most Recent Poster (28)
fackelwind - Frequent Poster (10)
zogstrip - Frequent Poster (2) [2/ 1]
envieme - Frequent Poster (4) [1]
repz - Frequent Poster (next to last)

So it looks like the number of posts in the thread is important, as are the “last” posts.
i.e. a combination of both post count and post sequence.

The odd man out here is zogstrip who has only 2 posts in the topic yet is before envieme who has 4 posts in the topic.

Reason? My guess would be that Staff or maybe Trust Level are weighted more.

I suspected the number of Likes might be a factor, but if it is it doesn’t look to be in this case.


#3

Yah, it must be something like that and your guesses seem very plausible. Thanks (at least now I know I haven’t overlooked something very simple / I’m not going crazy)!

One would think weights for presentation order should be functionally described somewhere (or even configurable).

Sadly I can not dig into the nitty gritty details (me not being a programmer). Maybe an official developer can shed some light on the deployed algorithm’s specifics?


(Jeff Atwood) #4

No, it is very simple. First poster leftmost, last poster rightmost, then the three most frequent posters in between from left to right in descending order. Anything else is a bug.


(Sam Saffron) #5

in chronological order, not decending, I changed that ages ago.

Eg:

For topic X top repliers are Bob, Bill, Fred.

After that we may display it as Bill, Fred, Bob … IF Bob happened to make the reply prior to last.

There idea is to keep chronology in the list.


(Jeff Atwood) #6

Ah, I forgot about that change completely. Sorry. My bad.


(Mittineague) #7

I think I’ve found the file and the explanation for zogstrip with 2 posts coming before envieme with 4 posts.

in app/models/topic_featured_users.rb

There’s

  def self.count
    4
  end

and

  SELECT id, user_id, ROW_NUMBER() OVER(PARTITION BY id ORDER BY last_post_date ASC) as rank
  FROM cte
  WHERE rank <= #{count}

That is,
the OP is always first
then members that made more than 4 posts ordered by their number of posts descending
then chronological
last avatar always the last poster unless also the OP

Like or Trust Level are not considered.


#8

Hmmm… If one looks at the Api documentation topic none of the explanations seem to map onto it (or I am overlooking something):

Topic overview:

Banner (within topic):

Post order: both when I start from the beginning and reverse from the end; I can not seem to reverse-engineer it to any of the explanations (not even when grouping by amounts of post and chronologically ordering them within those groups).

Am I overlooking something? Is anyone able map his/her explanation on that (or another) existing topic, in order to enlighten me?

The first/far-left (OP) and last/far-right (LP) ones are clear, but the three in the middle are not. They are usually the top posters, but esp. the presentation-order still confuses me (I do not seem to recognize a chronological order, nor a descending based on their relative amount of post).

e.g. - the Api documentation topic - how come pjv is preferred over Jared_Needell in that case?


(Neil Lalonde) #9

That list sorts by number of replies, not chronological order.


#10

The banner does yes, I am still talking about the the small icon list in the Topic overview; so:

So far I can confirm:

  • far-left = OP
  • far-right = latest poster
  • the three in between: frequent posters (min.lvl. 4 posts?)

(Mittineague) #11

Did you have a chance to look at the topic_featured_users.rb file yet?

Are you having trouble understanding the SQL logic?

    SELECT
        t.id,
        p.user_id,
        MAX(p.created_at) last_post_date,
        ROW_NUMBER() OVER(PARTITION BY t.id ORDER BY COUNT(*) DESC, MAX(p.created_at) DESC) as rank
    FROM topics t
    JOIN posts p ON p.topic_id = t.id
    WHERE p.deleted_at IS NULL AND
          NOT p.hidden AND
          p.post_type in (#{Topic.visible_post_types.join(",")}) AND
          p.user_id <> t.user_id AND
          p.user_id <> t.last_post_user_id
          #{filter}
    GROUP BY t.id, p.user_id

In the API documentation topic there are enough members that have made more than 4 posts in the topic so the <= 4 bit isn’t needed.

p.user_id <> t.user_id takes the OP out of it
p.user_id <> t.last_post_user_id takes the last poster out.

What remains is a result sorted by post count and post date.

What might be confusing is that both Jared_Needell and pjv made 7 posts.

The code needs to “pick one”.

At first it might look like because Jared_Needell has more recent post dates that he would be chosen.

The clue as to why not is in

GROUP BY t.id, p.user_id

With a little digging it can be found that the user_id’s are
Jared_Needell 16325
pjv 1176

That is, pjv has a much lower user id.


#12

AH! That was the answer to my last question mark! So indeed it then is:

[OP] [top3-posters (when identical then "oldest member"): chronologically ordered] [last poster, unless OP then another frequent poster and op gets highlighted].

Thank you all for taking the time to dig into it and - moreover - explaining it to newbies such as yours truly!


(Jeff Atwood) #13

Is this a bug then @sam? Is it picking based on user id sequence, rather than last post order sequence? I guess that is correct if they “both have 7 posts” but it’s not correct if you maintain that the order should not be based on number of posts, but last post date within the top 3?


(Sam Saffron) #14
PARTITION BY t.id ORDER BY COUNT(*) DESC, MAX(p.created_at)

looks like topic.id and then post created at… so seems right to me.