forms
forms copied to clipboard
Feature: Allow shuffling of answer options | Sort options
- 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)
Codecov Report
Merging #1271 (641a003) into master (78a5301) will increase coverage by
0.01%
. The diff coverage is38.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
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.
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).
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)
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. 😉
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).
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 Fixed your comments. Sorry for the inconvenience, I will try to test better.
@Chartman123 wanna double-check here? :wink: