|
|
|
Broken not only old questions, but I can't edit them and add losed questions again. I don't think the history of questions has anything to do with it, at least with 'questiontype numerical not recognized' message.
Some questions was moved, other don't. The questions was backuped, then restored in new course. Then old course with categories, where they were created was deleted. But that was some time ago, and all seems to work fine. I upgrade to 1.9. when it was released, then don't upgrade until latest two weekly builds. The problem started after this event. There was no change is question/type/multianswer/questiontype.php since february.
For your old questions you could have a problem of having deleted the subquestions that are related to the main question. If you have access to the database look 1. note the id of one of your old cloze questions by looking at the link at the edit button . 2. look in the database in mdl_question table to see if there are questions with the parent parameter set to the question id. There supposed to be one subquestion for each question included in the cloze question. I CVS the last 19_STABLE some days ago and there is no problems with cloze question. You can test yourself at http://132.208.141.198/moodle_19/ user:moodle pw: moodle OK I pinpoint the possible origin of "questiontype numerical not recognized" message.
more tomorrow... I test the problem once more. I can create completely new question, it works. I just can't create subquestions in old questions, so you probaly were right in some way. But if I just delete old subquestions, why can't I create new subquestions in them?
But it is necessary to modify these questions since we have production site in work. I can't replace question in quiz without deleting students attempts, which isn't an option. I try to get manual access to the database tomorrow. The messages
Call to a member function get_correct_responses() on a non-object in /hosts/edu/www/question/type/multianswer/questiontype.php on line 252 and questiontype numerical not recognized". are related to the lost of the subquestions that where not move and lost when you deleted categories. I will modify the code so that at least the user can edit the old question and have a more explict message. Actually you can edit although you will have to rebuild all the question code inside the { } if you save as a new question. By any chance have you the "The questions was backuped". You could get all your questions if you backup again and don't delete the old categories. Quiz system doesn't give me chance to save as new question. It must be exactly same question, or I'll have to delete all students attempts to insert new questions in the quiz. The number of questions are small, and if there is a way to edit them I can restore them easely, but our superiors.
P.S. Actually not moving subquestions is quite a bug (or moving them at least is a very needed improvment). Maybe we can create new issue to do this? Or simply fix it? As a programmer I can't understand, why this is such problem? The simplest way is to add a hook function to default_questiontype class, which will be called during question move, and by default do nothing, but will be overloaded in multianswer question to move it's subquestions too. This doesn't hurt any existing code (except that we have insert calls in every code that move question). I can try to create a fix by myself if it will be merged in Moodle code by you, but you know better all areas of code where question can be moved, I can miss some of them. The number of questions are small,
Ok, I will work a patch that allow you to edit the questions. I have link this to Taking of context there is a new modification that does not allow you to delete those subquestions, they are "automatically" moved to an upward category that cannot be deleted. However clear coding should let the question types move themselves and I am not sure what happen when you destroy a course... "I am not sure what happen when you destroy a course... " - the simplest way is to move them in default category for the parent context (thanks for the new question sharing system), default category for all Moodle installation will never be deleted, so it's safe. Actually i think that clear code (which is preferrable) can be targeted for 2.0 (which has a goal to cleanup) if it cannot be created easily, and more simple solution can work in 1.9.1, because it's much needed.
Also, I suggest considering such extravagant situation of moving questions as backup and restore in another course (either new or existing). Here is a first version of multianswer/questiontype.php that should allow you to correct your questions.
edit_multianswer_question_form_.php follows the attach files need more testing before CVS...They work correctly on my site http://132.208.141.198/moodle_19/
The problem here seems to be with multianswer questions that have been backed up then restored. (Note that there is also the problem
The problem is that the question.parent field is not correctly recoded during the restore. I am working on a fix, hence the fact that I have reassigned the bug back to myself. I hope that is OK. Fortunately, there is enough information in the mdl_question_multianswer.sequence field that we should be able to fix up any existing broken questions. See http://docs.moodle.org/en/Development:Question_bank_consistency_check for some thoughts. It is Ok that you fix the back-up and restore.
I am working on better coding of multianswer if for any reasons the subquestions were lost. I think that the two patches are as you said somewhere orthogonals... I you agree , you can create a secondary task for wy work or I create a new bug... "Fortunately, there is enough information in the mdl_question_multianswer.sequence "
Unfortunately the subquestions were lost and the actual code of multianswer/questiontype.php and edit_multianswer_question_form_.php don't handle well the situation. This is why I am reworking this code having already done some work on it so I am sufficiently familiar for doing this but appreciate your knowledge of backup and restore :-) Further testin of the preliminary patches show that although they allow to correct questions, they create orphan sub questions when use more than one time on the same question. Working on...
Most of the problems have been solved on handling correctly in a quiz a multianswer where one or more subquestion has been lost and reediting the question so that the quiz results remain valid.
A more robust "experimental" version should be available next monday... Well, I hoped that subqestions was restored in the new course and Tim's patch on backup/restore will restore questions. It doesn't. So I have to wait more stable version of you new patch, Pierre.
here a 1.9 version that seems correct.
The messages need to be reworked. The question remain valid for the subquestions that have been found. Oleg, test them by creating a new question and use your db toll to delete the subquestions and see for yourself.
If the sub are lost, you will have to rebuilt them. The problem with the restore is that the questions (and the sub) will have a new id but the question->sequence will contain the old ids. If you look at your database question table locate the questions where the parent is not 0 or the question->id. These are subquestions. Look at them you will probably recognize the answers and could simply change there parentid to the new id of the main question and the sequence. This is if they subs were not deleted when you delete the categories. If this is the case do a new restore and look at the db . Everything will be there. I use you patch to manually reconstruct subquestions (fortunately we have general feedback avaible). It works well. (Actually using numerical questions this was much easier than try to find them in db and restore ids). Many thanks!
Right now I doesn't have the time to fully test you patch for any possible problems, sorry. If it's needed I probably can find time in a month. Oleg ,don't worry, I have done the testing and CVS to HEAD, should be CVS down to 1.6 soon.
Pierre, you probably forget to close this as fixed.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Will try to locate why you have this problem.
Did you move your question to another category? and have you deleted the first category?