Upgrading question type from 1.9.11 to 2.1

Re: Upgrading question type from 1.9.11 to 2.1

by Michael Schink -
Number of replies: 0

I didn't find a suitable method in the renderer.php of shortanswer. It consists only of 3 methods. formulation_and_controls (= print question & controls), specific_feedback and correct_response (= generate description/feedback -> return html strings).

Actually I use my "unbeautiful" solution, because I just need the right string (= name of CSS class) to "mark" the parts of the question in the same color (by adding a CSS class with javascript), like it is "marked" by moodle after grading (green, yellow, red). Former method question_get_feedback_class() does the same and only returns one of three strings.

I think classify_response() and get_possible_responses() are used to do some more exactly grading (-> grading subparts) and won't help in this case.

I spent some hours with writing docs, making code more readable, deleting old code/methods, reinstalling qt and testing. I just found some minor bugs, but that also existed in the old version.

But I still got a problem with the import of backup files of moodle 1.x. It seems that I have to create a subfolder moodle1/lib.php in the backup folder. In this file I extend the moodle1_qtype_handler class and have to implement the get_question_subpaths() method, which returns an array with path strings (, but which paths are meant?) and the process_question(array $data, array $raw) method. In the last method it seems common to use the $this->write_xml(..) method to write the question data to the questions.xml. So it is also possible to correct the question data in this method to adapt the data for new "DB-XML-schemata". I didn't change the DB structure during the upgrade (to prevent errors) and just want to get the data back. Do you have any ideas?

At the end I just want to thank you very much for your help Tim. Without your help the whole upgrade would have taken much much much longer. It took me about 130 hours to do the upgrade from 1.9 to 2.1 (and some little improvements). Is this a long time?