# Опрос с ранжированным выбором не отражает изменение голосов в итоговом результате

**URL:** https://meta.discourse.org/t/ranked-choice-poll-does-not-reflect-change-of-votes-in-outcome/321227
**Category:** Bug
**Tags:** polls
**Created:** [12.Август.2024 09:53:39 UTC](https://meta.discourse.org/t/ranked-choice-poll-does-not-reflect-change-of-votes-in-outcome/321227 "2024-08-12T09:53:39Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![reubenyap](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/reubenyap/32/439675_2.png) [@reubenyap](https://meta.discourse.org/u/reubenyap)
#### Post date: [12.Август.2024 09:53:39 UTC](https://meta.discourse.org/t/ranked-choice-poll-does-not-reflect-change-of-votes-in-outcome/321227/1 "2024-08-12T09:53:39Z")

</div>

У нас здесь есть опрос с ранжированным выбором: [[POLL] Final Tokenomics and Block Division - Polls - The Firo Forum](https://forum.firo.org/t/poll-final-tokenomics-and-block-division/3379)

Мы позволяем участникам менять свои голоса до даты закрытия.

Однако, когда мы меняем свои голоса, это не отражается на вкладке «Результаты/Голоса». Я не могу найти способ экспортировать данные из опроса, хотя являюсь администратором.

@merefield  
Думаю, это отдельная проблема от [FIX: poll ranked choice result algo majority check by merefield · Pull Request #28191 · discourse/discourse · GitHub](https://github.com/discourse/discourse/pull/28191).

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [12.Август.2024 09:56:44 UTC](https://meta.discourse.org/t/ranked-choice-poll-does-not-reflect-change-of-votes-in-outcome/321227/2 "2024-08-12T09:56:44Z")

</div>

Привет, Рубен, я напишу тебе в личные сообщения, чтобы обсудить детали.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [12.Август.2024 13:29:32 UTC](https://meta.discourse.org/t/ranked-choice-poll-does-not-reflect-change-of-votes-in-outcome/321227/3 "2024-08-12T13:29:32Z")

</div>

Похоже, что Реубен каким-то образом не получил недавнее исправление, и после обновления результат его опроса был корректно обработан.

Я также посоветовал ему добавить плагин [Data Explorer](https://meta.discourse.org/t/32566?silent=true), иначе опция экспорта будет недоступна (это нормально).

Однако мы обнаружили связанную проблему с разворачиванием списка голосовавших в результатах (когда их количество превышает 25) для рейтингового голосования (эта проблема отсутствует в обычных опросах).

Исправление здесь:

> <https://github.com/discourse/discourse/pull/28315>
>
> initially, the list of voters shown on the poll results has a limit of 25 per op…tion.
> 
> If the actual number of voters is longer, a button is presented to allow the user to load another page of voters if they so choose. 
> 
> This calls a method to retrieve the extra voter information.
> 
> a bug existed such that the local tracked object was not correctly updated for ranked choice voters as there are two attributes per option, one which tells the interface if new data is currently loading, and the other contains the list of voters. 
> 
> so instead of updating the entire option key with the voters list, we must update the voters attribute only.
> 
> a small but critical change.
> 
> The PR includes a significant new test which will add coverage over and above this issue.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [13.Август.2024 09:16:42 UTC](https://meta.discourse.org/t/ranked-choice-poll-does-not-reflect-change-of-votes-in-outcome/321227/4 "2024-08-13T09:16:42Z")

</div>

@reubenyap это уже слито, пожалуйста, обновите ваш экземпляр, и исправление должно быть доступно. Подтвердите, пожалуйста.

---

<div class="post-metadata">

### Author: ![ajaydono](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ajaydono/32/439676_2.png) [@ajaydono](https://meta.discourse.org/u/ajaydono)
#### Post date: [13.Август.2024 13:05:32 UTC](https://meta.discourse.org/t/ranked-choice-poll-does-not-reflect-change-of-votes-in-outcome/321227/5 "2024-08-13T13:05:32Z")

</div>

Привет, после обновления всё ещё не отображаются люди, изменившие свой голос.  
SS1

 ![image](https://global.discourse-cdn.com/meta/original/4X/e/b/9/eb9a9dbbff70eb3f32e0fe70e496089dd5303813.png)

---

<div class="post-metadata">

### Author: ![ajaydono](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ajaydono/32/439676_2.png) [@ajaydono](https://meta.discourse.org/u/ajaydono)
#### Post date: [13.Август.2024 13:06:15 UTC](https://meta.discourse.org/t/ranked-choice-poll-does-not-reflect-change-of-votes-in-outcome/321227/6 "2024-08-13T13:06:15Z")

</div>

Нажатие кнопки «ещё/развернуть» под каждым голосом просто показывает это.  
SS2

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

После чего через пару секунд оно снова переключается на предыдущий вариант (SS1).

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [13.Август.2024 13:08:26 UTC](https://meta.discourse.org/t/ranked-choice-poll-does-not-reflect-change-of-votes-in-outcome/321227/7 "2024-08-13T13:08:26Z")

</div>

> [@ajaydono](#):
>
> Привет, после обновления

Не могли бы вы поделиться коммитом Discourse, на котором вы находитесь, из панели управления?

---

<div class="post-metadata">

### Author: ![reubenyap](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/reubenyap/32/439675_2.png) [@reubenyap](https://meta.discourse.org/u/reubenyap)
#### Post date: [13.Август.2024 13:13:20 UTC](https://meta.discourse.org/t/ranked-choice-poll-does-not-reflect-change-of-votes-in-outcome/321227/8 "2024-08-13T13:13:20Z")

</div>

### 3.4.0.beta1-dev

([9641835743](https://github.com/discourse/discourse/commits/9641835743899e19c9a45f129d5c69c8e4d3b922))

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [13.Август.2024 13:28:53 UTC](https://meta.discourse.org/t/ranked-choice-poll-does-not-reflect-change-of-votes-in-outcome/321227/9 "2024-08-13T13:28:53Z")

</div>

Хорошо, верьте или нет, но исправление действительно улучшило ситуацию, однако требуется дополнительная работа, чтобы предотвратить «сброс» обновлений, что в продакшене происходит быстрее, чем в среде разработки.

Нам нужно тщательно продумать, как обрабатывать входящие обновления после расширения списка голосующих.

Я склоняюсь к тому, чтобы заморозить список голосующих от удалённых обновлений после нажатия вами кнопки или установить тайм-аут, чтобы вы могли в течение ограниченного времени изучить список голосующих перед принятием обновлений с сервера.

Спасибо за ваше терпение.

---

<div class="post-metadata">

### Author: ![reubenyap](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/reubenyap/32/439675_2.png) [@reubenyap](https://meta.discourse.org/u/reubenyap)
#### Post date: [13.Август.2024 13:52:20 UTC](https://meta.discourse.org/t/ranked-choice-poll-does-not-reflect-change-of-votes-in-outcome/321227/10 "2024-08-13T13:52:20Z")

</div>

Список избирателей меняется КРАЙНЕ значительно, что выходит за рамки обычного изменения голоса. Мне кажется, что что-то всё ещё не так.

ПЕРЕД нажатием

 ![image](https://global.discourse-cdn.com/meta/original/4X/8/4/e/84e3c7005b94aed2158ae4769a36cec4fa11ca87.png)

---

<div class="post-metadata">

### Author: ![reubenyap](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/reubenyap/32/439675_2.png) [@reubenyap](https://meta.discourse.org/u/reubenyap)
#### Post date: [13.Август.2024 13:53:35 UTC](https://meta.discourse.org/t/ranked-choice-poll-does-not-reflect-change-of-votes-in-outcome/321227/11 "2024-08-13T13:53:35Z")

</div>

После нажатия всех кнопок: обратите внимание, как происходит значительный сдвиг, и люди исчезают.  
Обновление страницы возвращает вас к предыдущему экрану.

 ![image](https://global.discourse-cdn.com/meta/original/4X/5/3/2/532de3717b30c94c4af3b2ddae1e32e305733032.png)

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [14.Август.2024 08:35:39 UTC](https://meta.discourse.org/t/ranked-choice-poll-does-not-reflect-change-of-votes-in-outcome/321227/12 "2024-08-14T08:35:39Z")

</div>

Дополнительный PR был создан:

> <https://github.com/discourse/discourse/pull/28352>
>
> An additional follow-up change on top of #28315 (which is still a valid improvem…ent) is required as currently expanded voter lists are almost immediately overwritten by incoming data on the message bus and post stream and effectively cancels the expansion leading to an uncomfortable user experience. This was unfortunately not picked up during unit testing nor by manual testing because in dev the refresh cycle is so long.
> 
> So to prevent this and allow a user time to examine the expanded voter list, this change renders incoming updates for voter user lists disabled as soon as any option's voters list is expanded. This only impacts big polls with \> 25 voters on an option,
> 
> I believe this is a reasonable compromise and it still allows polls with fewer than 26 votes on an option to continue to be streamed updates to voter population as this change does not affect that scale of poll as there is never any expansion action.
> 
> Background:
> 
> \`preloadedVoters\` is a list of all users who have voted. It is maintained locally on the client because the data can change from incoming updates from remote voting events \_and\_ from local events, such as voting or expansion of the collapsed list of voters.
> 
> In order to save resources, the server by default will initially only serialize the first 25 voters (per option) down to the client. If the user wishes to see more, they hit the provided expand button. This will pull down an additional page of voters. There are therefore two paths for update and the server does not keep track of the state of the local user interface.
> 
> More on the fix:
> 
> A user can restore the update process by navigating away from the Topic and returning or refreshing the browser (and that will revert the expanded list to the collapsed view - no change in that behaviour).
> 
> It obviously has no downside on Closed polls.
> 
> Test updated to reflect the change.

---

<div class="post-metadata">

### Author: ![reubenyap](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/reubenyap/32/439675_2.png) [@reubenyap](https://meta.discourse.org/u/reubenyap)
#### Post date: [16.Август.2024 16:54:39 UTC](https://meta.discourse.org/t/ranked-choice-poll-does-not-reflect-change-of-votes-in-outcome/321227/13 "2024-08-16T16:54:39Z")

</div>

Просто уточняю: нормально ли, что если вы изменили свой голос ранее, то до развёртывания голосования ваш голос не отображается в списке голосов?

Например, я изменил свой голос пару дней назад, но когда я возвращаюсь к опросу, мой голос отображается в списке, хотя в необработанных данных он присутствует.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [19.Август.2024 08:42:44 UTC](https://meta.discourse.org/t/ranked-choice-poll-does-not-reflect-change-of-votes-in-outcome/321227/14 "2024-08-19T08:42:44Z")

</div>

Привет, @reubenyap — не имело смысла углубляться в расследование, пока это исправление не будет слито.

Теперь оно слито.

Вы должны заметить значительное улучшение.

Если останутся какие-либо проблемы, я свяжусь с вами позже. Дайте знать, как у вас получится с этим улучшением.

---

<div class="post-metadata">

### Author: ![reubenyap](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/reubenyap/32/439675_2.png) [@reubenyap](https://meta.discourse.org/u/reubenyap)
#### Post date: [19.Август.2024 12:42:30 UTC](https://meta.discourse.org/t/ranked-choice-poll-does-not-reflect-change-of-votes-in-outcome/321227/15 "2024-08-19T12:42:30Z")

</div>

Список избирателей до и после расширения всё ещё различается (хотя это различие последовательно сохраняется даже у разных пользователей).

@ajaydono и @Anwar предоставят более подробную информацию.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [19.Август.2024 12:44:14 UTC](https://meta.discourse.org/t/ranked-choice-poll-does-not-reflect-change-of-votes-in-outcome/321227/16 "2024-08-19T12:44:14Z")

</div>

Различие в списке избирателей _ожидаемо_.

По сути, вы начинаете с ограниченного списка избирателей, а после расширения получаете больше избирателей.

Если голоса _изменяются_ (например, с 1-го места на 2-е), это было бы проблемой, но в ходе моих тестов я такого не наблюдал.

Обратите внимание: после расширения списка голосование фиксируется в состоянии на момент расширения и больше не обновляется в реальном времени. На данный момент это вынужденный компромисс.

---

<div class="post-metadata">

### Author: ![Anwar](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/anwar/32/440467_2.png) [@Anwar](https://meta.discourse.org/u/Anwar)
#### Post date: [19.Август.2024 12:52:29 UTC](https://meta.discourse.org/t/ranked-choice-poll-does-not-reflect-change-of-votes-in-outcome/321227/18 "2024-08-19T12:52:29Z")

</div>

![chrome_2024_08_19_18_27_31](https://global.discourse-cdn.com/meta/original/4X/7/9/1/791eb3689e5f0949a92cd2b47025e31846cbfa5c.png)

**До расширения**

 ![chrome_2024_08_19_18_27_43](https://global.discourse-cdn.com/meta/original/4X/d/0/3/d0366a527b173147b0a15473011228b04a4af356.png)

**После расширения**

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [02.Сентябрь.2024 06:55:46 UTC](https://meta.discourse.org/t/ranked-choice-poll-does-not-reflect-change-of-votes-in-outcome/321227/19 "2024-09-02T06:55:46Z")

</div>

Обратите внимание: этот PR был создан и должен окончательно закрыть эту проблему, так как он уже был протестирован на экземпляре создателя бага через форк плагина опросов:

> <https://github.com/discourse/discourse/pull/28432>
>
> Currently, for Ranked Choice results and voter list expansion, the code is repla…cing the voter list with the newly fetched page of voters instead of appending to the existing voter list. This is resolved in this PR and brings it in line with regular polls.
> 
> See: https://meta.discourse.org/t/ranked-choice-poll-does-not-reflect-change-of-votes-in-outcome/321227/18?u=merefield
> 
> I've made the tests more strict to cover this and confirmed test failure with existing code without this fix.
> 
> NB I'm aware code changes around this functionality have been a little numerous of late, so this time, in the interest of minimising review burden and curtailing the iteration, I made sure the changes in this PR were fully tested in Production on the very poll which identified the issue. We've successfully tested the solution in the Production instance of the bug raiser and they have signed off. (We removed the core plugin in app.yml and cloned a fork of Poll that includes these changes).

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [18.Сентябрь.2024 06:58:54 UTC](https://meta.discourse.org/t/ranked-choice-poll-does-not-reflect-change-of-votes-in-outcome/321227/20 "2024-09-18T06:58:54Z")

</div>

Будем признательны, если вы сможете объединить это исправление до того, как код устареет.

---

<div class="post-metadata">

### Author: ![Anwar](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/anwar/32/440467_2.png) [@Anwar](https://meta.discourse.org/u/Anwar)
#### Post date: [18.Сентябрь.2024 11:27:09 UTC](https://meta.discourse.org/t/ranked-choice-poll-does-not-reflect-change-of-votes-in-outcome/321227/21 "2024-09-18T11:27:09Z")

</div>

Было бы здорово слить этот PR, так как он очень помог нашему сообществу и будет полезен и другим сообществам Discourse.

[Следующая страница](https://meta.discourse.org/t/ranked-choice-poll-does-not-reflect-change-of-votes-in-outcome/321227.md?page=2)
