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

**URL:** https://meta.discourse.org/t/what-determines-the-order-of-frequent-poster-icons-in-the-topic-list/44669
**Category:** UX
**Created:** [Mai 23, 2016, 1:20 UTC](https://meta.discourse.org/t/what-determines-the-order-of-frequent-poster-icons-in-the-topic-list/44669 "2016-05-23T13:20:58Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![woosting](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/woosting/32/78134_2.png) [@woosting](https://meta.discourse.org/u/woosting)
#### Post date: [Mai 23, 2016, 1:20 UTC](https://meta.discourse.org/t/what-determines-the-order-of-frequent-poster-icons-in-the-topic-list/44669/1 "2016-05-23T13:20:58Z")

</div>

**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)?

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [Mai 23, 2016, 8:43 UTC](https://meta.discourse.org/t/what-determines-the-order-of-frequent-poster-icons-in-the-topic-list/44669/2 "2016-05-23T20:43:33Z")

</div>

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

Using [Topic Ratings Plugin](https://meta.discourse.org/t/topic-ratings-plugin/39578) 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.

---

<div class="post-metadata">

### Author: ![woosting](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/woosting/32/78134_2.png) [@woosting](https://meta.discourse.org/u/woosting)
#### Post date: [Mai 24, 2016, 9:18 UTC](https://meta.discourse.org/t/what-determines-the-order-of-frequent-poster-icons-in-the-topic-list/44669/3 "2016-05-24T09:18:10Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [Mai 24, 2016, 4:04 UTC](https://meta.discourse.org/t/what-determines-the-order-of-frequent-poster-icons-in-the-topic-list/44669/4 "2016-05-24T16:04:09Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [Mai 25, 2016, 12:02 UTC](https://meta.discourse.org/t/what-determines-the-order-of-frequent-poster-icons-in-the-topic-list/44669/5 "2016-05-25T00:02:07Z")

</div>

> [@codinghorror](#):
>
> left to right in descending order.

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.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [Mai 25, 2016, 12:02 UTC](https://meta.discourse.org/t/what-determines-the-order-of-frequent-poster-icons-in-the-topic-list/44669/6 "2016-05-25T00:02:35Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [Mai 25, 2016, 12:14 UTC](https://meta.discourse.org/t/what-determines-the-order-of-frequent-poster-icons-in-the-topic-list/44669/7 "2016-05-25T00:14:44Z")

</div>

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

```plaintext
  def self.count
    4
  end

```

and

```plaintext
  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.

---

<div class="post-metadata">

### Author: ![woosting](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/woosting/32/78134_2.png) [@woosting](https://meta.discourse.org/u/woosting)
#### Post date: [Mai 25, 2016, 2:46 UTC](https://meta.discourse.org/t/what-determines-the-order-of-frequent-poster-icons-in-the-topic-list/44669/8 "2016-05-25T14:46:22Z")

</div>

Hmmm… If one looks at the [Api documentation topic](https://meta.discourse.org/t/discourse-api-documentation/22706/1) none of the explanations seem to map onto it (or I am overlooking something):

**Topic overview:**  
 ![](https://global.discourse-cdn.com/meta/original/3X/4/3/43abd0f6bf6716c2be148f0c2c60b48eca83986e.png)

**Banner (within topic):**  
 ![](https://global.discourse-cdn.com/meta/original/3X/5/9/5909a7bfb47aeeebaf5c14a900b34b09d293becd.png)

**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](https://meta.discourse.org/t/discourse-api-documentation/22706/1) - how come [pjv](https://meta.discourse.org/users/pjv/activity) is preferred over [Jared\_Needell](https://meta.discourse.org/users/jared_needell/activity) in that case?

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [Mai 25, 2016, 2:49 UTC](https://meta.discourse.org/t/what-determines-the-order-of-frequent-poster-icons-in-the-topic-list/44669/9 "2016-05-25T14:49:48Z")

</div>

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

---

<div class="post-metadata">

### Author: ![woosting](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/woosting/32/78134_2.png) [@woosting](https://meta.discourse.org/u/woosting)
#### Post date: [Mai 25, 2016, 9:28 UTC](https://meta.discourse.org/t/what-determines-the-order-of-frequent-poster-icons-in-the-topic-list/44669/10 "2016-05-25T21:28:18Z")

</div>

The banner does yes, I am still talking about the the small icon list in the Topic overview; so:  
[![](https://global.discourse-cdn.com/meta/original/3X/4/3/43abd0f6bf6716c2be148f0c2c60b48eca83986e.png) ](https://global.discourse-cdn.com/meta/original/3X/4/3/43abd0f6bf6716c2be148f0c2c60b48eca83986e.png)

So far I can confirm:

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

> [@woosting](#):
>
> 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?

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [Mai 25, 2016, 10:20 UTC](https://meta.discourse.org/t/what-determines-the-order-of-frequent-poster-icons-in-the-topic-list/44669/11 "2016-05-25T22:20:39Z")

</div>

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

Are you having trouble understanding the SQL logic?

```plaintext
    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

```plaintext
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.

---

<div class="post-metadata">

### Author: ![woosting](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/woosting/32/78134_2.png) [@woosting](https://meta.discourse.org/u/woosting)
#### Post date: [Mai 26, 2016, 10:33 UTC](https://meta.discourse.org/t/what-determines-the-order-of-frequent-poster-icons-in-the-topic-list/44669/12 "2016-05-26T22:33:58Z")

</div>

> [@Mittineague](#):
>
> 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

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!

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [Mai 26, 2016, 10:37 UTC](https://meta.discourse.org/t/what-determines-the-order-of-frequent-poster-icons-in-the-topic-list/44669/13 "2016-05-26T22:37:16Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [Mai 26, 2016, 10:48 UTC](https://meta.discourse.org/t/what-determines-the-order-of-frequent-poster-icons-in-the-topic-list/44669/14 "2016-05-26T22:48:36Z")

</div>

```plaintext
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.
