News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Is the order of poll options supposed to be fixed?

Started by m4z, September 09, 2019, 06:13:00 AM

Previous topic - Next topic

m4z

In my 2.1rc2 postgres forum, we have a few polls running for a few days.
When creating a poll, you have to fill out numbered options, and up until now, we expected those to be "ordered". Now, suddenly, for some polls the order of the options has changed. Even when clicking "Edit Poll", the options are at the same different numbers (the same that their order in the topic view suggest).

This is really annoying for Doodle-style date (appointment) finding polls, or when you expect a certain order ("yes/no/don't care"). The correlation of option labels to their number-of-votes seems to be correct, at least.  :-X

Is this expected behavior?

(The order of the options in the screenshot was previously chronological non-US style dates: 15.09., 22.09., 29.09., ...)
"Faith is what you have in things that don't exist."
--Homer Simpson

Es gibt hier im Forum ein deutsches Support-Board!

m4z

I think I've got a grasp on the current behavior now:
- The option (or options) that were last voted for by somebody move to the bottom of the list
- If (more than one option is possible and if) more than one option was actually voted for, all voted items move to the bottom, ordered alphanumerically.
"Faith is what you have in things that don't exist."
--Homer Simpson

Es gibt hier im Forum ein deutsches Support-Board!

Arantor

There is no storage for position of a given poll choice per se beyond its id, and the query does not try to order anything on the basis that it will naturally fall into expected order historically for MySQL, and currently for both systems it is "whatever order you happen to get from the DB" though MySQL will by its design tend to be more consistent about ordering than PGSQL.

Query to change: https://github.com/SimpleMachines/SMF2.1/blob/8d19779a446b31de8c0effef453afbc144eeeafb/Sources/Display.php#L675

m4z

Thank you very much for this pointer and explanation!
"Faith is what you have in things that don't exist."
--Homer Simpson

Es gibt hier im Forum ein deutsches Support-Board!

m4z

I wrote a PR. Thanks so much for the pointer, it would probably have taken me hours to find the relevant code piece.
"Faith is what you have in things that don't exist."
--Homer Simpson

Es gibt hier im Forum ein deutsches Support-Board!

Arantor

Former developer knowledge gotta be useful for something, right? ;D

Advertisement: