within my Moodle 3.5 and up-to-date StudentQuiz activity, me and my students created a lot of questions there.
However, when I wanted to export them I get the error https://docs.moodle.org/35/en/error/moodle/invalidrecord .
I can duplicate questions and move them to other folder (category), but I would be glad to export the whole studentquiz category.
Any help, please ?
PS: In between I found this related bug , https://tracker.moodle.org/browse/MDL-54724 . So my questions, grouped in StudentQuiz activity, must contain a faulty question_multianswer, because the error message says (translated from Slovak) says something about not possible to find record in database table for question_multianswer.
Well, in my studentquiz, there should be a faulty question, because a student reported it once to me. But now, from among 196 questions, it is difficult to find out which question is the faulty one.
Well, in between I found the faulty question of cloze type, which a student "succeeded" to create in the StudenQuiz. But as teacher I can do nothing - no editing, no deleting, no preview possible, it always throws out error message.
How can Moodle admin fix such issue ?
Frank, as teacher, I see delete/edit/preview buttons, but simply they do not work for this superfaulty question, neither in StudentQuiz nor in its Question Bank subarea.
How could a student create such fishy cloze-question ?
I have no idea how you got into this situation, but you wrote "I can duplicate questions and move them to other folder (category), but I would be glad to export the whole studentquiz category."
So what about if you move the problematic question into another category to get rid of this question within StudentQuiz? For this purpose you could create a dummy category within the course questionbank (not the StudentQuiz questionbank). Later you can see this dummy category within the StudentQuiz questionbank.
Maybe you can even delete the problematic question from the course questionbank.
Hope this works, Frank
unfortunately, duplicating the fishy question does not work (sorry, I wrote it wrong), but moving to a dummy category worked. However, there, I still can not delete/edit/view this isolated question, as it throws the same error.
Likewise, the studentquiz category, even without the faulty question, still can not be exported, giving the very same error.
there are no essay type questions in my set (now has 195 questions, including calculated), which has restricted question types to automatic ones.
I am waiting for admin to delete the faulty cloze question, which is isolated in separate subfolder of the course.
I will keeep this thread updated, becase this seems to be a serious vulnerability of Moodle 3.5/cloze question.
in between, our admin checked the quaestions database record table and made an artificiall fix (filling empty record) of presumably wrong question. It helped to the extent that fishy question was allowed to be moved elsewhere and deleted. Buf export the whole studentquiz category remains failing. Maybe this is related to the https://tracker.moodle.org/browse/MDL-54724 .
Can you ask your admin if he remember what artificial fix he did or if I can contact him ?
The problem with MDL-54724 is that despite many efforts I am unable to understand how broken multianwer questions are created in the first place.
My guess was that they could be created during backup/restore. But your problem with StudentQuiz clearly show that it is possible to create broken multianswer using the Moodle interface. I already fixed MDL-60897 that was one case where it was possible to create such broken questions, but as it was only fixed recently in Moodle 3.4.6 and 3.5.3 maybe that was that bug that permitted your student to create a broken question, but maybe not and maybe there are other undiscovered ways to create broken questions ?
So any information about broken multianswer questions could be useful. Don't hesitate to post your observations as comments to MDL-54724.
One thing that I don't understand is that if this faulty question was properly removed why are you still unable to export the whole studentquiz category ?
following https://tracker.moodle.org/browse/MDL-60897 I found that with Moodle 3.5.2 I was able to create faulty embedded answers (Cloze) question.
Now admin upgraded our Moodle to 3.5.3+ (Build: 20190111) and creation of faulty cloze questions got blocked as well as I was able to delete all previously created faulty questions.
What remained, however, that I still can not export the whole StudentQuiz question set, getting "error/moodle/invalidrecord".
In between, upon checking all cloze questions created by students, I found another faulty type of cloze question, see https://tracker.moodle.org/browse/MDL-64558 .
Well, concerning the faulty export, it would be good to have some tool for fixing questions database.
I am interested (of course) in your problem.
Any information about how you managed to create a broken formulas question would be interesting.
Also re you able to look into the database and to find the record for this question in the mdl_question table , note it's id value, then see if there is a record in the mdl_qtype_formulas_options table with questionid equal to the id of the first record and finally find how many records there are in the mdl_qtype_formulas_answers table with questionid equal to the id of the first record.
I was already thinking to improve some functions to make formulas more robust so that broken question can be edited or deleted and all your results would help me, because I was never able to create a broken formulas question using the question editor from Moodle, I can only make "fake" formulas broken questions editing records directly in the database.
Thanks a lot for your help
Can you give me some help with the SLQ queries?
I managed to get the ID and the record by this query:
SELECT * FROM `mdl_question` WHERE id=18572
However, after that I get stuck. How exactly do I have to formulate the other two queries?
As for the question how I managed to produce a faulty Formulas question, I don't know what exactly happened. What I remember is that when I tried to save the question I had an error message from Moodle which I was not able to correct. I finally had to redo the question and ended up with two faulty versions of it which I removed to another category because the JSON error message showed up whenever I tried to access the question bank of the test in question. The most likely reason is a problem with the Internet connection.
But I will send you the results from the database query, as soon as I'm able to.
As for the time, it happened on the 8th of December which is after I had upgraded to Moodle 3.5.3.
can you do the following queries (assuming that your first query with id=18572 return the broken question)
* FROM `mdl_qtype_formulas_options` WHERE questionid=18572
SELECT * FROM `mdl_qtype_formulas_answers` WHERE questionid=18572
The first one should return exactly 1 record
The second one should return 1 or several records depending on how many parts your question have
I am not only interested by the number of records but also by their content (if any). If you don't want to post the result here you can send them to me privately.
Both queries result in a blank, there seems to be no records in the database.
On that note: How does the question type control for complete questions?
Could it be that the problem is caused by a non standard SQL table prefix?
In my database I don't use the mdl_ prefix, but a different one.
Thanks that is an indication of the place where the code has failed.
In my current work, I am trying to:
- Warn the user that the formulas question is broken (usefull to help to correct the problem)
- Permit to edit and delete the question by providing default record when one is missing.