Question Order When Importing Hot Pot Quiz

Question Order When Importing Hot Pot Quiz

by Kathleen Edelman -
Number of replies: 6

When I upload my hotpot quizzes, Moodle uploads it very well.  When we view the questions it orders them 1, 11,12, 13  etc.  and I want it in order of 1, 2, 3, 4.

What can I do about this?

Average of ratings: -
In reply to Kathleen Edelman

Re: Question Order When Importing Hot Pot Quiz

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Maybe we could order them 001, 002, 003 ? I'll look into it.
In reply to Gordon Bateson

Re: Question Order When Importing Hot Pot Quiz

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Gordon,
Maybe using the php natcasesort function?
Joseph
In reply to Joseph Rézeau

Re: Question Order When Importing Hot Pot Quiz

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Hi Joseph,
it's a very interesting idea to use PHP's "natcasesort" sorting function. At the moment, the sorting is done by the database functions when the questions are fetched by the following line in the in the "question_list" function in "question/editlib.php" (about line 255)

$questions = get_records_select(
'question',
"category IN ($categorylist) AND parent = '0' $showhidden",
$sortorder
,

'*',
$page*$perpage,
$perpage
)

at this point, $sortorder is one of the following:
  • name, qtype ASC : Sort by name
  • qtype, name ASC : Sort by type, name
  • id ASC : Sort by age
I myself am not able to update this script, but I think it would certainly be worth mentioning "natural" sorting over on the forum for the Quiz module

regards
Gordon
In reply to Gordon Bateson

Re: Question Order When Importing Hot Pot Quiz

by Glenys Hanson -
Hello,

I'm not sure if this is the same problem or a different one.
The same thing happened when I imported Hot Pot JQuiz questions into a Moodle Quiz: the questions were ordered as described above. A colleague told me to select "sort by age" and it solved the problem.

Cheers,
Glenys
In reply to Glenys Hanson

Re: Question Order When Importing Hot Pot Quiz

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Bingo! Nice work Glenys.

What's more this setting seems to be "sticky", so that one you have used it on the Edit Quiz/Question page, then it is remembered and used again when you come back to that page later.

Kathleen, does this work for you?

In reply to Gordon Bateson

Re: Question Order When Importing Hot Pot Quiz

by Kathleen Edelman -

Thanks so much for that help.  It does work for us.  My collegues will be VERY happy.  : )