Add ability for answer positions to be shuffled
Closed, ResolvedPublic

Description

It might make sense to have an option that the answers be shuffled in a new position with each new page load.

  • shuffleanswers="true" to the quiz tag, to do it globally for all questions in the quiz
  • Add parameter inside each question to turn on or off shuffling for a particular question, i.e.
{ Question text here
|type="{}"
|shuffle="true"
}

or

{ Question text here
|type="{}"
|shuffle="false"
}

Idea partially from: https://www.mediawiki.org/wiki/Extension_talk:Quiz#Make_printable_paper_copies_feasible_using_.22print.22_option_for_in-class_testing

Mvolz created this task.Jul 17 2017, 10:21 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 17 2017, 10:21 AM
Mvolz renamed this task from Add ability for answer positions to be shuffled on load to Add ability for answer positions and question positions to be shuffled on load.Jul 17 2017, 10:28 AM
Mvolz updated the task description. (Show Details)
Mvolz closed this task as Invalid.Jul 17 2017, 12:05 PM

I guess this is what the shuffle control i.e. {{x}} are for!

Mvolz reopened this task as Open.Jul 17 2017, 12:10 PM

I guess this is what the shuffle control i.e. {{x}} are for!

Never mind, those are for questions, not answers.

Mvolz updated the task description. (Show Details)Jul 17 2017, 12:11 PM

If I'm right then we're trying to achieve quiz such that for each question the order of proposal (answer) changes.

For example if a question is :

Sample Question 
 Option 1
 Option 2
 Option 3
 Option 4

then after reloading it can be :

Sample Question 
 Option 2
 Option 4
 Option 1
 Option 3
Mvolz added a comment.Aug 5 2017, 3:36 PM

If I'm right then we're trying to achieve quiz such that for each question the order of proposal (answer) changes.

For example if a question is :

Sample Question 
 Option 1
 Option 2
 Option 3
 Option 4

then after reloading it can be :

Sample Question 
 Option 2
 Option 4
 Option 1
 Option 3

Yes, that's the idea. The order would be random every time the page loaded. (although obviously not after submit).

Harjotsingh added a comment.EditedAug 5 2017, 3:47 PM

Yes, that's the idea. The order would be random every time the page loaded. (although obviously not after submit).

This can be done on server side, the only issue that might happen would be to keep the order same after submit.
As the page reloads after submit, the order will change.Also the requests use proposal ids for checking values, this might cause wrong checking of the questions.

The way to persist the order after submitting would require to send the order itself inside the POST request would that be considered a good method to achieve this ?

Harjotsingh added a comment.EditedAug 12 2017, 1:31 PM

We can shuffle the proposals and their respective feedback on every reload.
After submission we can keep the order the way it was provided in the quiz syntax.

If we want the order to be the way it was before submission then maybe we can use a Php's self variable to store the order of that quiz.
Would that be fine @Mvolz ?

Also regarding feedback how is it coupled with a proposal ? A proposal can have multiple feedback after and before.

Example -

//General expected behaviour 

{Question
|type="()"}
-A
|| Feedback for A
-B
|| Feedback for B
-C
|| Feedback for C
-D
|| Feedback for D

//Multi line feedback behaviour 

{Question
|type="()"}
-A
|| Feedback for A
|| in
|| multiple 
|| lines
-B
|| Feedback for B
-C
|| Feedback for C
-D
|| Feedback for D

// Reverse behaviour

{Question
|type="()"}
|| Feedback for A
-A
|| Feedback for B
-B
|| Feedback for C
-C
|| Feedback for D
-D

// Random behaviour 
{Question
|type="()"}
|| Feedback for A
-A
|| Another Feedback for A
-B
|| Feedback for B
-C
|| Feedback for C
-D
|| Feedback for D

How do we decide which behaviour is used to link feedback to proposal ?
If we link proposal with the feedback after it then case 3 and 4 might cause problem.

Mvolz added a comment.EditedAug 14 2017, 9:02 AM

I don't think it matters *that* much what the order is after submission,
although it might be slightly confusing for the quiz taker? Why don't you
submit what you have an we can take a look at it? You can upload changes for review that
aren't necessarily ready to be merged by putting [WIP] in the subject line,
i.e. "[WIP] Shuffle questions onload".

Mvolz added a comment.Aug 14 2017, 9:03 AM

You can wrap both the feedback and the proposal in the same div, and then shuffle based on that div.

You can wrap both the feedback and the proposal in the same div, and then shuffle based on that div.

I understand that proposal and feedback are supposed to be wrapped together, however how do we check that the feedback is associated with a proposal ?
Consider the following case :

{Question
|type="()"}
|| Feedback for A
-A
|| Another Feedback for A
-B
|| Feedback for B
-C
|| Feedback for C
-D
|| Feedback for D

Here A has two feedback, one after and one before.

{Question
|type="()"}
|| Feedback for A
-A
|| Feedback for B
-B
|| Another Feedback for B
-C
|| Feedback for C
-D
|| Feedback for D

Here the order in which feedback is presented is changed.
We can either add in documentation that a feedback should always be after the proposal.This way we can be sure that their won't be any inconsistencies.

Mvolz added a comment.Aug 14 2017, 1:35 PM

You can wrap both the feedback and the proposal in the same div, and then shuffle based on that div.

I understand that proposal and feedback are supposed to be wrapped together, however how do we check that the feedback is associated with a proposal ?
Consider the following case :

{Question
|type="()"}
|| Feedback for A
-A
|| Another Feedback for A
-B
|| Feedback for B
-C
|| Feedback for C
-D
|| Feedback for D

Here A has two feedback, one after and one before.

{Question
|type="()"}
|| Feedback for A
-A
|| Feedback for B
-B
|| Another Feedback for B
-C
|| Feedback for C
-D
|| Feedback for D

Here the order in which feedback is presented is changed.
We can either add in documentation that a feedback should always be after the proposal.This way we can be sure that their won't be any inconsistencies.

The documentation already says "Feedback is set with all types by using a double vertical line || immediately after a response." If it is behaving different than that, that's probably a bug. Feedback should only be showing up the question preceding it.

The feedback before the proposals can be global question feedback and we can leave it in that position while shuffling the proposals and other feedback.

I've made a patch implementing the same.

Change 372130 had a related patch set uploaded (by Harjotsingh; owner: Harjotsingh):
[mediawiki/extensions/Quiz@master] Add ability for proposal positions to be shuffled on load

https://gerrit.wikimedia.org/r/372130

Mvolz renamed this task from Add ability for answer positions and question positions to be shuffled on load to Add ability for answer positions to be shuffled.Aug 21 2017, 11:42 AM
Mvolz updated the task description. (Show Details)
Mvolz updated the task description. (Show Details)
Mvolz triaged this task as Normal priority.

I've put the shuffling question part of this into a different phab task to avoid confusion: T173706

Mvolz updated the task description. (Show Details)Aug 21 2017, 11:52 AM

Change 374035 had a related patch set uploaded (by Harjotsingh; owner: Harjotsingh):
[mediawiki/extensions/Quiz@master] Add ability for proposal positions to be shuffled on load

https://gerrit.wikimedia.org/r/374035

Change 372130 abandoned by Harjotsingh:
Add ability for proposal positions to be shuffled on load

Reason:
Changing this to post request patch would have taken more time, so I made a new patch.

Patch using POST request at: https://gerrit.wikimedia.org/r/#/c/374035/

https://gerrit.wikimedia.org/r/372130

Change 374035 merged by jenkins-bot:
[mediawiki/extensions/Quiz@master] Add ability for proposal positions to be shuffled on load

https://gerrit.wikimedia.org/r/374035

Harjotsingh closed this task as Resolved.Aug 29 2017, 12:57 PM