Moodle

Quiz Import: unable to import Cloze question because of "generalfeedback" column

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.8.2
  • Fix Version/s: 1.7.3, 1.8.3, 1.9
  • Component/s: Questions
  • Labels:
    None
  • Affected Branches:
    MOODLE_18_STABLE
  • Fixed Branches:
    MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE

Description

I am unable to import any Cloze question. All attempts end with the following error message:

ERROR: null value in column "generalfeedback" violates not-null constraint

INSERT INTO mdlspa_question ( ID, CATEGORY, NAME, QUESTIONTEXT, DEFAULTGRADE, QTYPE, STAMP ) VALUES ( 21, 3, '::A simple Cloze question:: ', '::A simple Cloze question:: This question consists of some text with an answer embedded right here {#1} and right after that you will have to deal with this short answer {#2} and finally we have a floating point number {#3}. Note that addresses like www.moodle.org and smileys all work as normal: a) How good is this? {#4} b) What grade would you give it? {#5} Good luck! ', 8, 'multianswer', 'www.agenturaspa.cz.web4ce.cz+070820170240+12NB4D' )

  • line 1425 of lib/dmllib.php: call to debugging()
  • line 234 of question/format.php: call to insert_record()
  • line 181 of question/import.php: call to qformat_default->importprocess()

I am attaching the file to be imported (it is the question from http://moodle.org/help.php?module=quiz&file=multianswer.html)

Activity

Hide
Howard Miller added a comment -

I am unable to reproduce this problem on my test 1.8.2+ (latest CVS) site.

Can you upgrade to the latest version of 1.8.2+ and try again?

Show
Howard Miller added a comment - I am unable to reproduce this problem on my test 1.8.2+ (latest CVS) site. Can you upgrade to the latest version of 1.8.2+ and try again?
Hide
David Mudrak added a comment -

Hello Howard. What DB were zou using? The error was reported at PostgreSQL site. I think that as Moodle is now using XML schema, this should not matter. But who knows?

Show
David Mudrak added a comment - Hello Howard. What DB were zou using? The error was reported at PostgreSQL site. I think that as Moodle is now using XML schema, this should not matter. But who knows?
Hide
Howard Miller added a comment -

I tested this with MySQL.

I'm honestly a bit sceptical though. The 'generalfeedback' field is definitely initialised in the question object setup and I don't think the database in use should make any difference to that. We've actually never had an import/export bug related to a particular database as far as I can remember but, as you say, who knows?

What I also don't quite understand is

ID, CATEGORY, NAME, QUESTIONTEXT, DEFAULTGRADE, QTYPE, STAMP

where is 'generalfeedback' in this insert?

Show
Howard Miller added a comment - I tested this with MySQL. I'm honestly a bit sceptical though. The 'generalfeedback' field is definitely initialised in the question object setup and I don't think the database in use should make any difference to that. We've actually never had an import/export bug related to a particular database as far as I can remember but, as you say, who knows? What I also don't quite understand is ID, CATEGORY, NAME, QUESTIONTEXT, DEFAULTGRADE, QTYPE, STAMP where is 'generalfeedback' in this insert?
Hide
David Mudrak added a comment -

> where is 'generalfeedback' in this insert?

IMHO it is the point. The INSERT statement does not set a value for "generalfeedback" column, which is set as NOT NULL in the mod/quiz/db/install.xml scheme. Therefore, the error is raised.

Show
David Mudrak added a comment - > where is 'generalfeedback' in this insert? IMHO it is the point. The INSERT statement does not set a value for "generalfeedback" column, which is set as NOT NULL in the mod/quiz/db/install.xml scheme. Therefore, the error is raised.
Hide
Howard Miller added a comment -

Good point

Ok, upgrade!! If there is still a problem, it's going to need some debugging (by you). You would need to insert

echo "<pre>"; print_r( $question ); die;

in front of that insert_record() code in question/format.php to check that the question object is correct. That won't be the answer but will demonstrate where to look next. If you cannot upgrade then you're going to have to do this anyway.

Show
Howard Miller added a comment - Good point Ok, upgrade!! If there is still a problem, it's going to need some debugging (by you). You would need to insert echo "<pre>"; print_r( $question ); die; in front of that insert_record() code in question/format.php to check that the question object is correct. That won't be the answer but will demonstrate where to look next. If you cannot upgrade then you're going to have to do this anyway.
Hide
Tim Hunt added a comment -

Howard, this about MoodleXML format, right?

If so, I think I have fixed it, since I noticed it and spotted the solution, but please can you check what I have done. Thanks.

Note, we were not exporting general feedback from Cloze questions, which I guess was another aspect of this bug, so I fixed that too.

Show
Tim Hunt added a comment - Howard, this about MoodleXML format, right? If so, I think I have fixed it, since I noticed it and spotted the solution, but please can you check what I have done. Thanks. Note, we were not exporting general feedback from Cloze questions, which I guess was another aspect of this bug, so I fixed that too.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: