# Polls - how to see order of votes

**URL:** <https://meta.discourse.org/t/polls-how-to-see-order-of-votes/70605>\
**Category:** Feature\
**Created:** [2017年九月22日 20:05 UTC](https://meta.discourse.org/t/polls-how-to-see-order-of-votes/70605 "2017-09-22T20:05:40Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![krydda01](https://avatars.discourse-cdn.com/v4/letter/k/b5a626/32.png) [@krydda01](https://meta.discourse.org/u/krydda01)\
**Post date:** [2017年九月22日 20:05 UTC](https://meta.discourse.org/t/polls-how-to-see-order-of-votes/70605/1 "2017-09-22T20:05:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)\
**Post date:** [2017年九月22日 20:20 UTC](https://meta.discourse.org/t/polls-how-to-see-order-of-votes/70605/2 "2017-09-22T20:20:15Z")

</div>

You can make the poll public

 ![image](https://global.discourse-cdn.com/meta/original/3X/e/6/e6608d7b788b7e26b98cc75464fd4999066f74db.png)

---

<div class="post-metadata">

**Author:** ![krydda01](https://avatars.discourse-cdn.com/v4/letter/k/b5a626/32.png) [@krydda01](https://meta.discourse.org/u/krydda01)\
**Post date:** [2017年九月22日 20:23 UTC](https://meta.discourse.org/t/polls-how-to-see-order-of-votes/70605/3 "2017-09-22T20:23:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)\
**Post date:** [2017年九月22日 22:24 UTC](https://meta.discourse.org/t/polls-how-to-see-order-of-votes/70605/4 "2017-09-22T22:24:08Z")

</div>

Oh, I see, you will probably want to use a [data explorer](https://meta.discourse.org/t/32566?silent=true) 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](https://meta.discourse.org/t/is-it-possible-to-see-who-voted-in-polls/27064/4)

---

<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:** [2017年九月25日 07:13 UTC](https://meta.discourse.org/t/polls-how-to-see-order-of-votes/70605/5 "2017-09-25T07:13:21Z")

</div>

> [@krydda01](#):
>
> but not in what order, since the avatar seems to be displayed in a random order.

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

---

<div class="post-metadata">

**Author:** ![saurabhp](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/saurabhp/32/125182_2.png) [@saurabhp](https://meta.discourse.org/u/saurabhp)\
**Post date:** [2018年十二月14日 05:05 UTC](https://meta.discourse.org/t/polls-how-to-see-order-of-votes/70605/6 "2018-12-14T05:05:10Z")

</div>

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:

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

```plaintext
user_ids = PollVote
            .where(poll: poll, poll_option: poll_option)
            .group(:user_id)
            .order("MIN(created_at)")
            .offset(offset)
            .limit(limit)
            .pluck(:user_id)

```

---

<div class="post-metadata">

**Author:** ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)\
**Post date:** [2018年十二月14日 09:27 UTC](https://meta.discourse.org/t/polls-how-to-see-order-of-votes/70605/7 "2018-12-14T09:27:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)\
**Post date:** [2018年十二月14日 09:27 UTC](https://meta.discourse.org/t/polls-how-to-see-order-of-votes/70605/8 "2018-12-14T09:27:06Z")

</div>


