Polls - how to see order of votes

AI-generated summary

The discussion revolves around displaying the order of votes in polls on Discourse. krydda01 asked if it’s possible to see the order in which users replied to a poll, as the current display seems to be random. cpradio suggested making the poll public, but krydda01 pointed out that this only shows who replied, not in what order. cpradio then suggested using a data explorer query, linking to a relevant discussion on meta.discourse.org.

However, saurabhp discovered that votes are already shown in the order they were created, after testing and reviewing the code. They shared relevant code snippets that demonstrate this. zogstrip confirmed that this is a side effect of the poll data layer refactoring. sam expressed support for displaying avatars in vote order, but this is no longer necessary given saurabhp’s findings.

I sometime use polls where I invite people to a gathering. There could however be a maximum number of attendees, so I’d like to see in what order they have replied, to enable me to see who answered first and therefor who can come.

Is there any way to see this or is there an attribute to make the avatars show up in the order people replied? I have tried to find an answer to this and apologies if it’s already explained elsewhere.

You can make the poll public

「いいね!」 3

Thank you @cpradio, I do use this feature. This makes me able to see who has replied, but not in what order, since the avatar seems to be displayed in a random order.

Oh, I see, you will probably want to use a data explorer query. I think there is a query around here for extracting poll results, I’ll see if I can find it.

I found this:
https://meta.discourse.org/t/is-it-possible-to-see-who-voted-in-polls/27064/4?u=cpradio

「いいね!」 4

I totally support changing poll to display the avatars in “vote” order. pr-welcome

「いいね!」 6

I was testing this on my system. Votes are already shown in vote order(aka created order). I tried making few polls and seeing their votes, they were shown in vote order itself.

Also from code, I can see that votes are returned in order of created_at.

Relevant code:

votes = DB.query <<~SQL
            SELECT digest, user_id
              FROM (
                SELECT digest
                     , user_id
                     , ROW_NUMBER() OVER (PARTITION BY poll_option_id ORDER BY pv.created_at) AS row
                  FROM poll_votes pv
                  JOIN poll_options po ON pv.poll_option_id = po.id
                 WHERE pv.poll_id = #{poll.id}
                   AND po.poll_id = #{poll.id}
              ) v
              WHERE row BETWEEN #{offset} AND #{offset + limit}
          SQL

and

user_ids = PollVote
            .where(poll: poll, poll_option: poll_option)
            .group(:user_id)
            .order("MIN(created_at)")
            .offset(offset)
            .limit(limit)
            .pluck(:user_id)
「いいね!」 1

Yes, it’s a nice (for once :ok_hand:) side effect of the refactoring of the poll data layer.

「いいね!」 4