Polls - how to see order of votes

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 Likes

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 Likes

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

6 Likes

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 Like

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

3 Likes