Urgent help needed for cloze question

Urgent help needed for cloze question

by Luis Vázquez de Lara -
Number of replies: 12

Hi,

I recently upgraded to  Moodle 2.1.3. When trying to create a cloze question an error writing to database appears:

Error writing to database

Debug info: Incorrect integer value: 'W' for column 'answerformat' at row 1
UPDATE mdl_question_answers SET question = ?,answer = ?,feedback = ?,answerformat = ?,fraction = ?,feedbackformat = ? WHERE id=?
[array (
0 => 2047,
1 => 'W',
2 => 'Feedback for this wrong answer',
3 => 'W',
4 => '0',
5 => '1',
6 => 4827,
)]
Stack trace:
  • line 397 of /lib/dml/moodle_database.php: dml_write_exception thrown
  • line 999 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
  • line 1031 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->update_record_raw()
  • line 92 of /question/type/multichoice/questiontype.php: call to mysqli_native_moodle_database->update_record()
  • line 424 of /question/type/questiontypebase.php: call to qtype_multichoice->save_question_options()
  • line 143 of /question/type/multianswer/questiontype.php: call to question_type->save_question()
  • line 424 of /question/type/questiontypebase.php: call to qtype_multianswer->save_question_options()
  • line 185 of /question/type/multianswer/questiontype.php: call to question_type->save_question()
  • line 264 of /question/question.php: call to qtype_multianswer->save_question()
The old cloze questions work well but I can't create a new one. I use the plugin of Prof. Rezeau to use regexp in cloze questions. I also imported cloze question from hotpotatoes and worked well
Any help will be greatly appreciated
Thanks
Luis
Average of ratings: -
In reply to Luis Vázquez de Lara

Re: Urgent help needed for cloze question

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I think I remember that bug. Try upgrading to 2.1.4+, or seach in the track to try to find the fix.

In reply to Luis Vázquez de Lara

Re: Urgent help needed for cloze question

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

@Luis: the problem may come from my not having yet upgraded the hack to make the Cloze question type compliant with my REGEXP question type in that version of Moodle. I will try to enquire as soon as possible.

@Tim: As I've asked quite a few times already wink it would be really nice if 3rd party question types could have a way of being "recognized" by the Cloze question type, alongwith the "core" question types. It would be much better than having to hack one or 2 core Cloze question files for each new moodle version.

Joseph

In reply to Joseph Rézeau

Re: Urgent help needed for cloze question

by Luis Vázquez de Lara -

Hi Tim and Joseph:

I upgraded te version to 2.1.4+ as adviced, but before adding the plugin of Joseph (before overwriting the files questiontype.php and renderer.php in the moodle/question/type/multianswer folder), I checked the problem and it is still there, only that the error is different. It allows to save the question but when previewing it the error message says something like it doesn´t support wiki-like formatting. After adding the regexp plugin, if there is a multiple choice question in the cloze question, the error quoted in this thread appears.

Where can I find the fix to this problem?

I checked in a server where version 2.2 is running and also in that version the problem is still there.

Thank you so much for your help, old questions look well, but I can´t create new ones and I already began courses.

Thanks

Luis

In reply to Luis Vázquez de Lara

Re: Urgent help needed for cloze question

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi Luis,

A. Using standard multianswer files in moodle 2.1.4.

1.- I've just created a Cloze question on my moodle 2.1.4 test site and everything works fine. I used the text from Example 2 in the Moodle docs. What happens if you try creating a Cloze question using that example?

2.- What happens when you click the "Decode and verify question text" button?

2.- "the error message says something like it doesn´t support wiki-like formatting." It would be helpful to have the exact error message.

B.- Using my modified multianswer files for using REGEXP in moodle 2.1.

Everything works as expected.

Conclusion: there must be something wrong on your moodle site somewhere. Please provide more information so we can help.

Joseph

In reply to Joseph Rézeau

Re: Urgent help needed for cloze question

by Luis Vázquez de Lara -

Hi Joseph:

Thank you very much for your response.

If I substitute de files questiontype.php and renderer.php in the moodle/question/type/multianswer folder with the original ones of the version 2.1.4+ and paste the example 2 that you suggested, then the question shows up corrrectly, with no error messages. When I change again these folders with those that allow the usage of regexp in cloze question, then the error pasted in the first message appears.  Do you think is possible that something is wrong with the files I have? Could you send me the again the files for cloze questions? .

Thank you so much for your interest and patience

Luis

In reply to Luis Vázquez de Lara

Re: Urgent help needed for cloze question

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi Luis,

Please attach the question text which triggers the error message you get.

I have attached the 2 files to be placed in question/type/multianswer/ for REGEXP to work inside a Cloze question.

Joseph

In reply to Joseph Rézeau

Re: Urgent help needed for cloze question

by Luis Vázquez de Lara -

Hi Joseph:

Thank you so much for your help. I changed the files for the new ones and everything is working pretty well. I thoroughly tested the cloze question in my server and no error messages appeared. Unfortunately the server for the whole medical school generates the error message "Wiki-like formatting has been removed from Moodle" when using multichoice questions in cloze question format, so I will keep waiting  for this fix.

Thanks to everyone for your help and best regards

Luis

In reply to Joseph Rézeau

Re: Urgent help needed for cloze question

by Pierre Pichet -

Hi Joseph,

I will try to locate this bug which as Tim , I have seen somewhere.

This test to eliminate old formating was added as a general test.

Pierre

In reply to Joseph Rézeau

Re: Urgent help needed for cloze question

by Rosaluz Ducoing -

Hello, I have tried to do a multichoice cloze question, I copied the example 2 you mentioned, and I get "error writing to database" and also "can't find registry in database for table question_multichoice" (or similar, I translated it from my spanish version). I am using moodle 2.1.1, if I create a cloze shortanswer question, it works fine.

thanks for your help

Rosaluz

In reply to Rosaluz Ducoing

Re: Urgent help needed for cloze question

by Rosaluz Ducoing -

Please disregard my last post, I have found in other posts that my curent version does not support cloze multichoice.

regards,

Rosaluz