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)?
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?
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.
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
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).
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
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!
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?