Moodle

Import/Export questions: error handler message missing for 'Cloze' type question while exporting questions to a GIFT file

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.9, 1.9.1, 1.9.2, 1.9.3, 1.9.4
  • Fix Version/s: 1.9.5, 2.0
  • Component/s: Questions
  • Labels:
    None
  • Database:
    Any
  • Difficulty:
    Easy
  • Affected Branches:
    MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE, MOODLE_20_STABLE

Description

We know that GIFT format only support Multiple-Choice, True-False, Short Answer, Matching and Numerical questions. Calculated & Cloze type questions are not supported by GIFT format. Usually, when a 'Calculated' type of question is exported to a GIFT format file, it will give a message to inform its non-supportive behavior towards GIFT format. But when a 'Cloze' type of question is exported to the same format, it neither displays any error/warning message nor exports the question to the file.

Steps to Reproduce
==============

1. Login in Cranberry Course 1.1.2 as Instructor/Admin

2. Click the 'Questions' link in the 'Administration' block

3. Create a 'Calculated' type of question

4. Click the 'Export' tab

5. Select 'GIFT' format and category with calculated type question

6. Uncheck category and context selection

7. Name the file

8. Export the questions

What Happens
===========

The Calculated type question gives an error handler message "No handler for qtype 'calculated' for GIFT export" but the Cloze type question does not give an such message. When the final created GIFT file is viewed, both the Calculated and Cloze type question do not appear in the file, rather do not get exported to the file (which is correct).

What Should Happen
================

There should be a similar error handler message saying "No handler for qtype 'cloze' for GIFT export" while exporting to a GIFT file which is currently missing (See screen shot).

Patch also included, welcome feedback and comments. If Martin or Tim OK'ed with it I could commit it into core. (This should be considered as a minor patch)...

Activity

Hide
Tim Hunt added a comment -

Import/Export -> Howard

Show
Tim Hunt added a comment - Import/Export -> Howard
Hide
Howard Miller added a comment -

Thanks for your very comprehensive report. I'll take a look.

Show
Howard Miller added a comment - Thanks for your very comprehensive report. I'll take a look.
Hide
Howard Miller added a comment -

GIFT export now gives an appropriate message (no longer hard coded) for any unsupported question type. Thanks for the report.

Show
Howard Miller added a comment - GIFT export now gives an appropriate message (no longer hard coded) for any unsupported question type. Thanks for the report.
Hide
Jerome Mouneyrac added a comment -

I reopen because I think the error message is not really explicit.

The error message for Cloze question is:
"No handler for question type multianswer" => not really explicit, I was expecting "Cloze" instead "multianswer"
The error message for Calculated question is:
"No handler for question type calculated" => OK

BTW, during reproducing the steps (calculated question creation) I saw multiple warning messages (there are quickly displayed during a redirection). It was about some undefined property $stdclass->category into question/question.php. If it doesn't concerns you Howard, let me know, I'll create a issue for that.
Thank you.

Show
Jerome Mouneyrac added a comment - I reopen because I think the error message is not really explicit. The error message for Cloze question is: "No handler for question type multianswer" => not really explicit, I was expecting "Cloze" instead "multianswer" The error message for Calculated question is: "No handler for question type calculated" => OK BTW, during reproducing the steps (calculated question creation) I saw multiple warning messages (there are quickly displayed during a redirection). It was about some undefined property $stdclass->category into question/question.php. If it doesn't concerns you Howard, let me know, I'll create a issue for that. Thank you.
Hide
Howard Miller added a comment -

Good point.... we need a look up for the correct question type name translation, that's all. I'm having nothing to do with calculated questions (don't understand them). Can you raise a new report for that?

Show
Howard Miller added a comment - Good point.... we need a look up for the correct question type name translation, that's all. I'm having nothing to do with calculated questions (don't understand them). Can you raise a new report for that?
Hide
Howard Miller added a comment -

It now looks up the questiontype name in the language pack. Looks much better!

Show
Howard Miller added a comment - It now looks up the questiontype name in the language pack. Looks much better!
Hide
Tim Hunt added a comment -

Actually, Howard, in Moodle 2.0, $QTYPES[$question->qtype]->local_name(); would be better - works with third-party plugins too. Sadly, there is no equivalent in Moodle 1.9.

I have checked in a fix.

Show
Tim Hunt added a comment - Actually, Howard, in Moodle 2.0, $QTYPES[$question->qtype]->local_name(); would be better - works with third-party plugins too. Sadly, there is no equivalent in Moodle 1.9. I have checked in a fix.
Hide
Howard Miller added a comment -

Yike..... I'll just have to take your word for it that that's easier Thanks Tim.

Show
Howard Miller added a comment - Yike..... I'll just have to take your word for it that that's easier Thanks Tim.
Hide
Howard Miller added a comment -

Just realised that the quiz name lookup in 1.9 won't work for custom plugins (will end up with [[...]]). Need to be a bit cleverer. Seeing as this comes up quite a bit a little function somewhere (if there isn't one already) is probably the answer.

Show
Howard Miller added a comment - Just realised that the quiz name lookup in 1.9 won't work for custom plugins (will end up with [[...]]). Need to be a bit cleverer. Seeing as this comes up quite a bit a little function somewhere (if there isn't one already) is probably the answer.
Hide
Howard Miller added a comment -

Questions do have a menu_name() method which (I think) will be the best bet in 1.9. Changing to that.

Show
Howard Miller added a comment - Questions do have a menu_name() method which (I think) will be the best bet in 1.9. Changing to that.
Hide
Jerome Mouneyrac added a comment -

It works well.
Thanks Wen for the report, Tim for your participation and Howard for your fixes.

Show
Jerome Mouneyrac added a comment - It works well. Thanks Wen for the report, Tim for your participation and Howard for your fixes.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: