academic-moodle-cooperation / moodle-mod_offlinequiz

The Offline Quiz activity allows the creation of multiple choice tests with questions from the question bank of a Moodle course, which are handed out to students in printed form. After completion, the answer forms are scanned and can be automatically evaluated online directly in Moodle.
https://academic-moodle-cooperation.org/mod_offlinequiz/
GNU General Public License v3.0
31 stars 58 forks source link

Error creating PDF forms, after upgrading from 2016072301 #45

Closed dashohoxha closed 6 years ago

dashohoxha commented 7 years ago

At Create forms / PDF forms I get this error message: "Error writing to database".

This is a new moodle installation (Moodle 3.3.1+ (Build: 20170810)) and the latest version of mod_offlinequiz (v3.3.0, 2017081100).

I have tried with previous versions of mod_offlinequiz, and PDF form generation works only with version 2016072301 (I have forced the installation of the old version with: moosh plugin-install -f mod_offlinequiz 2016072301)

With developer debug mode I get these error messages:

Notice: Undefined index: id_digits in /var/www/moodle/lib/dml/mysqli_native_moodle_database.php on line 1559
Debug info: Unknown column 'id_digits' in 'field list'
UPDATE mdl_offlinequiz SET id_digits = ? WHERE id = ?
[array (
0 => '7',
1 => '9',
)]
Error code: dmlwriteexception
Stack trace:
line 489 of /lib/dml/moodle_database.php: dml_write_exception thrown
line 1574 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
line 1780 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->set_field_select()
line 416 of /mod/offlinequiz/createquiz.php: call to moodle_database->set_field()

I upgrade Moodle by first making a dump of the database, then installing the new version, then a restore of the database:

Then I run php admin/cli/upgrade.php --non-interactive:

Maybe this process fails to upgrade the DB structure correctly (hence the missing column)?

kaspot commented 6 years ago

Thanks for your input. We forwarded this to our developer and added it to our list.

dashohoxha commented 6 years ago

I found a workaround: first uninstall the module and then install again the latest version:

moosh plugin-uninstall mod_offlinequiz
moosh plugin-install -f mod_offlinequiz 2017081100

I lost the existing offline-quizes in this process, but in my case this was not important.