ndunand / moodle-qtype_matrix

Source code of https://moodle.org/plugins/qtype_matrix
2 stars 10 forks source link

Import Error / Postgres #43

Closed sehomer closed 5 years ago

sehomer commented 5 years ago

Hi,

in our installation (Moodle 3.4.6 / PHP 7.1 / Postgres 9.5.15 Ubuntu 16.04) we get the following error while importing question bank categories containing matrix questions. Backup and restore also fails and duplicating test containing matrix questions, too. We use built 2018050701.

We would be very glad if you have any hints to get this solved, as failed imports by our teachers affect other questions too (missing images / duplicate questions).

Best regards Sebastian

Debug info: ERROR: null value in column "grademethod" violates not-null constraint DETAIL: Failing row contains (706, 270235, null, null, matrix, 1, 0). INSERT INTO mdl_question_matrix (questionid,multiple,grademethod,use_dnd_ui,shuffleanswers,renderer) VALUES($1,$2,$3,$4,$5,$6) RETURNING id [array ( 'questionid' => 270235, 'multiple' => NULL, 'grademethod' => NULL, 'use_dnd_ui' => '0', 'shuffleanswers' => '1', 'renderer' => 'matrix', )] Error code: dmlwriteexception

Stack trace: line 489 of /lib/dml/moodle_database.php: dml_write_exception thrown line 245 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end() line 966 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end() line 1014 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->insert_record_raw() line 57 of /question/type/matrix/libs/question_matrix_store.php: call to pgsql_native_moodle_database->insert_record() line 210 of /question/type/matrix/questiontype.php: call to question_matrix_store->insert_matrix() line 426 of /question/format.php: call to qtype_matrix->save_question_options() line 123 of /question/import.php: call to qformat_default->importprocess()

ndunand commented 5 years ago

Commit 99474d601ebb79d1158a79435b112fdb60fa7d4c fixed this but due to the nature of question formats, it is not yet feasible to export/import matrix questions fully. I.e. the rows, columns and weights of each matrix question will not be exported. However, this should at least not block the whole import process anymore.

danowar2k commented 4 years ago

Will you release a plugin version containing this fix?