forms icon indicating copy to clipboard operation
forms copied to clipboard

Feature: Allow shuffling of answer options | Sort options

Open susnux opened this issue 1 year ago • 1 comments

  • Resolves #1067 and fixes #1007

This introduces an question option to randomize the order of the answer options. Shuffling the order of the answer choices reduces bias in responses. (#1067)

If no shuffling is enabled the options are sorted in the order they were created, as currently they are shown as returned by the database which is not necessarily sorted. (#1007)

susnux avatar Jul 29 '22 16:07 susnux

Codecov Report

Merging #1271 (641a003) into master (78a5301) will increase coverage by 0.01%. The diff coverage is 38.46%.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1271      +/-   ##
============================================
+ Coverage     36.83%   36.84%   +0.01%     
- Complexity      507      512       +5     
============================================
  Files            47       48       +1     
  Lines          1960     1973      +13     
============================================
+ Hits            722      727       +5     
- Misses         1238     1246       +8     

codecov[bot] avatar Jul 29 '22 16:07 codecov[bot]

Just getting this on console, when adding a new question

Oh yes that happens if there are no settings as the empty array would be serialized as an array instead of an object (assoc. array). This is now fixed.

susnux avatar Sep 02 '22 09:09 susnux

Top 👍 Just one more thing i found now: When checking/unchecking the Shuffle-Checkbox, we should update the computed property of sortedOptions. Currently, this only takes effect after reloading the page (while editing the form).

jotoeri avatar Sep 05 '22 16:09 jotoeri

Hm while editing (at least in the editing view) options should not be shuffled (only in the submit view). But I will test this as soon as I got some time for preparing a test env, as currently master is broken (due to nextcloud-eventbus 3.0.1 dependency of nextcloud-vue which is already fixed but 3.0.2 is not released)

susnux avatar Sep 05 '22 16:09 susnux

Hm while editing (at least in the editing view) options should not be shuffled (only in the submit view).

When editing a single question, i'm totally with you. Then they should be ordered. But on Form-Editing, when not editing a single question (i.e. Within Create.vue, but edit=false of Question.vue), the options are currently unsorted (if set). I think that is fine, as this situation should indicate how the final form looks like, but it should also be reactive, so when unchecking the shuffle, then the options are directly shown as sorted (and the other way round).

due to nextcloud-eventbus 3.0.1 dependency of nextcloud-vue which is already fixed but 3.0.2 is not released

Do you know npm link? You can relatively quickly just clone eventbus master, ci, build, link and then link @nextcloud/event-bus on forms. Then it works with current master, so you can use it already. 😉

jotoeri avatar Sep 05 '22 18:09 jotoeri

When checking/unchecking the Shuffle-Checkbox, we should update the computed property of sortedOptions. Currently, this only takes effect after reloading the page (while editing the form).

Fixed that.

One general thing I noticed: Currently every interaction is debounced, resulting in a slight UI latency. Would it not be smoother to just debounce the request to the server? (As the UI is currently also not checking the request for success, meaning there is no rollback if that request failed).

susnux avatar Sep 06 '22 11:09 susnux

One general thing I noticed: Currently every interaction is debounced, resulting in a slight UI latency.

Hmm, i don't think the delay is much of a problem. It is anyways only visible on the two boolean switches and if we fix the actions to be inside of the Editing-Mode, then it even won't be visible that much. (#1329) I also have in mind, that chaning this would also increase the load on the browser due to permanently updating and triggering corresponding reactivities.

jotoeri avatar Sep 06 '22 20:09 jotoeri

@jotoeri Fixed your comments. Sorry for the inconvenience, I will try to test better.

susnux avatar Sep 06 '22 21:09 susnux

@Chartman123 wanna double-check here? :wink:

jotoeri avatar Sep 11 '22 20:09 jotoeri