Error importing WebCT quiz

Error importing WebCT quiz

by Zane Edwards -
Number of replies: 10
I am trying to import WebCT's quiz and am getting the following error:
\
1 error(s) detected
  • Too few :ANSWER, :Lx, :Rx statements for question line 0. You must define at last 2 possible answers
1 warning(s) detected
  • Missing question label after line 0
So no matter what, changing the question, I get it. I am using 1.6.
What am I missing? I uploaded a question that I tried.
Average of ratings: -
In reply to Zane Edwards

Re: Error importing WebCT quiz

by John Creed -
Below is what I found out with this and how I got the import to run correctly. Seems to be a few errors in the code that does the WebCT import

line 265 - question/format/webct/format.php
commented out this line.
//        $question = $this->defaultquestion();
it was causing the check on line 322 here
if (isset($question)) {  
to always be true since this was always defined
but the check on line 344
if (sizeof($question->answer) < 1) {
was always 0 as 0 question/answers where read first time thru

this led me to a problem that I fixed here

line 110 - question/type/multichoice/questiontype.php
was
    if (!insert_record("question_multichoice", $options)) {
now
    if (insert_record("question_multichoice", $options) === 0) {
the insert_record function returns the ID of the inserted record so the first check was always failing when it actually inserted OK

i saw this in a few other areas so it may be a problem elsewhere but we were only using multiple choice quesitons
Average of ratings: Useful (1)
In reply to John Creed

Re: Error importing WebCT quiz

by Michael Joyner -
Yes, that fixes my serious problem here, trying to get ready for the new semester, last thing I need is for webct imports to fail for new faculty just introduced to the system!
In reply to John Creed

Re: Error importing WebCT quiz

by Mike Jackson -
not sure why, but your suggestions allowed me to import Testgen questions which were exported into WebCT4 format.
In reply to Zane Edwards

Re: Error importing WebCT quiz

by Eduardo Hernandez -
Hello, we are also getting the same errors. It is very, very strange, as in Moodle 1.6 Beta versions, it was working OK for us. sad
In reply to Eduardo Hernandez

Re: Error importing WebCT quiz

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Strange! I am not aware that anything was changed between Beta and release.

However, I will take a look and let you know asap.
In reply to Howard Miller

Re: Error importing WebCT quiz

by Pierre Pichet -

I reported it in a bug report #5650 (30 may).

However the special coding of sad (: - (  ) gaves a special aspect to the bug report as you can see...

The import process exit at line 320 when :TYPE: indicating the start of the first question (generally line 2 or 3) is found
            if (eregi("^ sadTYPE|EOF):",$line)) {  

corrected it gaves

          if (eregi("^ : ^( TYPE|EOF):",$line))                // New Question or End of File


the code test for question components which are not found and exit.

One simple way to correct this is to check that we are at least after the second line and replace by
if (eregi("^ sadTYPE|EOF):",$line) and $nLineCounter > 2) 

corrected it gaves

if (eregi("^ : ^( TYPE|EOF):",$line))                // New Question or End of File


This will work also for files containing more than one question.


We need also to convert to utf8 before doing the analysis.
I propose the function utf8_encode_array() applied to $lines the array of $line.It is not in the current libs.
This was applied to french questions with accents that are not correctly decode without the utf8 conversion.
see the quizz forum for details and files.

http://moodle.org/mod/forum/discuss.php?d=46755

 

 

In reply to Pierre Pichet

Re: Error importing WebCT quiz

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Pierre,

I'm sorry - I'm struggling to follow your discussion. Do you by an chance have a coded solution to this. I'm more concerned about having a fix right now rather than understanding why it is broken - too much other stuff to catch up with smile

Your help will be very much appreciated.
In reply to Howard Miller

Re: Error importing WebCT quiz

by Pierre Pichet -

Hi Howard,

I think that I have an almost finished and bug corrected version of  the tool for importing the WEBCT courses
i.e. WebCT CE4 import tool of Dan Stowell.

http://moodle.org/mod/data/view.php?d=13&rid=94

As we import more things than the initial choices of Dan Stowell, the job took more times than expected as usualsmile.

We are testing it today on different courses or projects and I will give a complete report of this work.

This bring me back to the quiz and questions transfer from WebCT to Moodle.

As a teacher on WebCT you can export some or all your questions as a simple .txt file. If you have figures in your questions you have  to download them from from your my_files WebCT directory and port them to you moodle file course directory.

The actual Moodle WebCT import function (when corrected) could import the WebCT simple .txt question files.

However always as a teacher you can also export from WebCT in a .zip file all the quizzes and the questions of a course. The .zip contains a manifest.xml files and all the secondary .xml files, images and questionDB files to recontruct all the questions from your course. This is the  WebCT Quiz Migration Tool of Eric Schewe.

http://moodle.org/mod/forum/discuss.php?d=41967

I think that Moodle should offer the two import functions as a regular options.

I will post a debugged and more complete solution for the actual .txt WebCT import function in a few days (or nights) and extracted from Dan Stowell ( and Eric Schewe) code a second  WebCT .xml import function that could be added to the format.php files. The WebCT .xml export is not direclty compatible with the .xml QTI standards because of the WebCT structure and the absence of standards for question types like the calculated questions.

Sorry, sad for the delays...

Pierre

In reply to Pierre Pichet

Re: Error importing WebCT quiz

by Pierre Pichet -

As an answer to Cristina question

You mention the following:"If you have figures in your questions you have to download them from from your my_files WebCT directory and port them to you moodle file course directory."
in your posting.
I do have thousands of images to import into Moodle from all the math expressions in the quizzes. Is there a fast way of doing such import into Moodle? The only way I have seen so far is one at a time. I may be missing a more expeditive way of doing it due to my ignorance in Moodle. Could you please guide me a bit on this?

Thank you very much

Cristina

Actually you export them using the export function form webct of all your quizz and import them using the Eric tool when I will update the code to do it or as suggested in the preceeding message.

Just wait a little...

A NEW YEAR gift smile...