Reset the order of question types in the Question bank etc.

Reset the order of question types in the Question bank etc.

by Przemek Kaszubski -
Number of replies: 3
Picture of Particularly helpful Moodlers Picture of Testers
Hello,

Since Moodle 3.0 the order of question types prioritizes some:

these are - in this order:

Multiple Choice
True-False
Matching
Shost Answer
Numerical
Essay

This default is "sticky" in any language. The other question types are arranged alphabetically by the localised name. 

However, on sites that went through the upgrade from Moodle < 3.0 to Moodle >=3.0 the "old' order of the question types seems to have been retained = it is still fully alphabetical and respects localised names.

The admin can change the default order of the questions, but then - I believe- the localisation would be lost?
I'd like to remain in control of what my users see, and have so far avoided shifting these question types around.

I have a couple of related questions:

1) After the admin has tampered with the order of the question types - how can I reset it - i.e. bring it back to the default order?

2) In Moodle > 3.0 - is there a way to force the fully alphabetic & localised order of question types - as the default ? Is there a way to bypass the privileged 6 question types?

I have tried to look at the code of qtypes.php and some of the db tables, but have nor been able to discern anything, not being a programmer myself.

Many thanks for any help.

Przemek
Average of ratings: -
In reply to Przemek Kaszubski

Re: Reset the order of question types in the Question bank etc.

by Przemek Kaszubski -
Picture of Particularly helpful Moodlers Picture of Testers
Should this be of interest to anyone, I have found answers to my questions, though they do not seem very satisfactory.

The database table responsible for the order of question types is mdl_config_plugins . In the newer Moodles (3 and above) the first six positions in the table are the six "privileged", most common question types:

1 question multichoice_sortorder 1
2 question truefalse_sortorder 2
3 question match_sortorder 3
4 question shortanswer_sortorder 4
5 question numerical_sortorder 5
6 question essay_sortorder 6

By default only these six are explicitly listed in the table, and produce the "sticky" effect that resists alphabetisation.

Unfortunately, once the admin makes ANY changes to the default order of the question types on the /admin/qtypes.php page, all the other (core or external plugin) question types are appended to the table at the end . This effectively imposes the admin order across the board and removes any secondary **localised** alphabetic auto-arrangement. Only the one fixed manual order set by the admin is now effective :/ .

The \question\engine\bank.php file says the following when commenting on the sort_qtype_array function:

" * Sort an array of question types according to the order the admin set up,
* and then alphabetically for the rest. "

However, it appears that "alphabetically for the rest" will not work once the admin starts making changes. Everything is manual only.

There is no reset button on the UI qtypes.php interface page to revert the changes sad . The only solution is to:
- restore 1-6 ordering to the first six "popular plugins" using the /admin/qtypes.php page
- (possibly choose any other "sticky" types for positions 7 and later)
- then delete from the database table any other question type sortorder entries, so that (localised) alphabetic ordering can apply to them again (I think that if someone does NOT want ANY sticky items on the question types list, removing the first six entries will do the trick)
- IMPORTANT: purging the caches on the /admin/purgecaches.php page

The above characterises sites first installed as Moodle 3.0 or later versions.

On UPGRADED sites that began, for example, with Moodle 2.6, there are NO sticky question types listed in the mdl_config_plugins table. The listing is originally alphabetic throughout, and respects localisattion.

I have NOT tested this, but I would assume that the sticky question types favourites effect could be set manually by:
- manipulating the order of the questions types on the /admin/qtypes.php page
- then going to the database and the mdl_config_plugins tabel and deleting all those xyz_sortorder entries we do NOT want to be stickies but always arranged alphabetically by the local name, underneath the sticky items.
- purging the caches on /admin/purgecaches.php

In short, it is possible to resolve my issues if we have both admin UI AND phpMyAdmin etc. access to the Moodle database. Not ideal..

ERGO, those of us working on multi-language Moodle sites should think twice before customizing the question types list, and perhaps avoid touching it whatsoever if we don't have direct database access (needed to restore / control localised sorting of quiz question types).
Average of ratings:Useful (3)
In reply to Przemek Kaszubski

Re: Reset the order of question types in the Question bank etc.

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Thank you for this analysis. I guess this was implemented without thinking about the multi-lang issues.

It could be improved if someone wanted to work on it. I think I have too many other things on my todo list to consider it right now.
In reply to Tim Hunt

Re: Reset the order of question types in the Question bank etc.

by Przemek Kaszubski -
Picture of Particularly helpful Moodlers Picture of Testers
Thank you for your reply, Tim.

I will add a tracker issue for this, and hopefully one day it will get addressed.