pythonitalia / conference

Django app to manage conferences (part of the Python Italia website)
BSD 2-Clause "Simplified" License
3 stars 10 forks source link

Randomize talks order #13

Open rnditdev opened 6 years ago

rnditdev commented 6 years ago

In order to avoid statistical bias, randomize the talks before presenting them. Fundaments: https://www.surveygizmo.com/survey-blog/survey-question-order/

https://github.com/pythonitalia/conference/blob/7e5d9c462693d997e8507ee3a4c66ec5e4c0eb0e/conference/templates/conference/voting.html#L14

I think it should be enough to replace {% for t in talks %} by {% for t in shuffle(talks) %}

yakky commented 6 years ago

Thanks for the suggestion. The django template language does not allow the use of python functions in the templates: ordering must be done at the queryset level

rnditdev commented 6 years ago

Thank you for the correction, I see that the line to apply the shuffle (in case my suggestion is accepted) is

https://github.com/pythonitalia/conference/blob/7e5d9c462693d997e8507ee3a4c66ec5e4c0eb0e/conference/views.py#L739

talks = talks.order_by('speakersuserfirst_name', 'speakersuserlast_name') should be talks = shuffle(talks)

rnditdev commented 6 years ago

It could also apply to: https://github.com/pythonitalia/conference/blob/7e5d9c462693d997e8507ee3a4c66ec5e4c0eb0e/conference/views.py#L575