Quiz question not working.

Quiz question not working.

by John House -
Number of replies: 9

I recently moved our Moodle to a new server and upgraded from 2.6 to 2.8.1  I am running MySQL and everything works for the most part.  I do have an issue when it comes to quizzes.  I can create and edit the quiz but if I try to create a multiple choice question and save it I get error reading to database.  All other types of questions work.  Any ideas? 

Average of ratings: -
In reply to John House

Re: Quiz question not working.

by John House -

Debug info: Field 'answernumbering' doesn't have a default value
INSERT INTO mdl_qtype_multichoice_options (questionid,correctfeedback,partiallycorrectfeedback,incorrectfeedback) VALUES(?,?,?,?)
[array (
0 => 12218,
1 => '',
2 => '',
3 => '',
)]
Error code: dmlwriteexception

Stack trace:

  • line 446 of \lib\dml\moodle_database.php: dml_write_exception thrown
  • line 1164 of \lib\dml\mysqli_native_moodle_database.php: call to moodle_database->query_end()
  • line 1210 of \lib\dml\mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
  • line 118 of \question\type\multichoice\questiontype.php: call to mysqli_native_moodle_database->insert_record()
  • line 390 of \question\type\questiontypebase.php: call to qtype_multichoice->save_question_options()
  • line 264 of \question\question.php: call to question_type->save_question()
In reply to John House

Re: Quiz question not working.

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

answernumbering should have a default ("abc"). I don't know how that got lost during your upgrade, but if you manually add that default back in the database schema, then things shoud start working again.

Then, if you go to Site administration -> Development -> XMLDB editor, there is a [Check defaults] link you can click, to see if the move/upgrade introduced other similar problems.

In reply to Tim Hunt

Re: Quiz question not working.

by John House -

Sorry forgive my lack of knowledge but here is a view of the first few rows of answernumbering.  I am not sure what the default is supposed to be here.


capture

In reply to John House

Re: Quiz question not working.

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

You seem to be looking at the data in the table there.

You need to be looking at the definition of the table structure to find what the default is set to.

In reply to Tim Hunt

Re: Quiz question not working.

by John House -

Do you happen to have a query to find what the default value is set to? 

In reply to John House

Re: Quiz question not working.

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

Not off the top of my head. That is why I suggested:

"Then, if you go to Site administration -> Development -> XMLDB editor, there is a [Check defaults] link you can click"

If you do that, it will fetch the default for every column in every table, and compare the current value to what it should be. Then it will tell you all the ones that are wrong.

In reply to Tim Hunt

Re: Quiz question not working.

by John House -

I did see that is was not "OK"  when I checked the defaults.  I am just a little nervous about altering the default in the table.   I guess at this point I can set the default to "abc" and see if it works.