jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/368993 )

Change subject: Reassign numbering to shuffled questions
......................................................................


Reassign numbering to shuffled questions

Currently the shuffled questions also shuffles the number which distorts
the order in which the questions were shuffled.This patch reassigns the
numbering by adding shuffleNumbering function.

Bug:T170798
Change-Id: I71b0ae7ca47ef9d59a3f2bbba2d92ae35525b8d0
---
M modules/ext.quiz.js
1 file changed, 11 insertions(+), 2 deletions(-)

Approvals:
  jenkins-bot: Verified
  Mvolz: Looks good to me, approved



diff --git a/modules/ext.quiz.js b/modules/ext.quiz.js
index 6ea708b..bb98f78 100644
--- a/modules/ext.quiz.js
+++ b/modules/ext.quiz.js
@@ -72,8 +72,16 @@
                }
        }
 
-       /**
-        * Prepare the quiz for "javascriptable" browsers
+       // Reassign numbering to shuffled questions
+       function shuffleNumbering( $area ) {
+               $area = $area[0];
+               var list = $area.getElementsByClassName( 'questionId' );
+               for( var i =0; i < list.length ; ++i ) {
+                       list[i].innerHTML = i+1;
+               }
+       }
+
+       /** Prepare the quiz for "javascriptable" browsers
         *
         * @param {jQuery} $content The content area of the wiki page,
         *  passed by the `wikipage.content` hook
@@ -87,6 +95,7 @@
                // Display the shuffle buttons
                $input.filter( '.shuffle' ).click( function () {
                        shuffle( $( this.form ).find( 'div.quizQuestions' ) );
+                       shuffleNumbering( $( this.form ).find( 
'div.quizQuestions' ) );
                } );
                // Display the reset button
                $input.filter( '.reset' ).click( function () {

-- 
To view, visit https://gerrit.wikimedia.org/r/368993
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I71b0ae7ca47ef9d59a3f2bbba2d92ae35525b8d0
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh <harjo...@ymail.com>
Gerrit-Reviewer: Mvolz <mv...@wikimedia.org>
Gerrit-Reviewer: Reedy <re...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to