Moodle
  1. Moodle
  2. MDL-3724

Cloze not working in Moodle 1.5.1

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.1
    • Fix Version/s: None
    • Component/s: Quiz
    • Labels:
      None
    • Environment:
      All
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_15_STABLE
    • Rank:
      8496

      Description

      I suddenly get errors with the 1.5 cloze. I tried several cloze texts including

      the examples from the help, but got allways the same result. The same cloze

      works in Moodle 1.6 beta. What could that be?

      *Moodle Version:* Moodle 1.5.1 (2005060210) from today

      *Quiz Module Version:* 2005060301

      Error: Missing question answers!

      Unable to get options for questiontype 3 (id=30)

      Davon profitieren Anleger, die ein

      Warning: Invalid argument supplied for foreach() in

      C:\Xampp\htdocs\moodle_15\moodle\mod\quiz\questiontypes\multichoice\questiontype.php

      on line 230

      Warning: Invalid argument supplied for foreach() in

      C:\Xampp\htdocs\moodle_15\moodle\mod\quiz\questiontypes\multianswer\questiontype.php

      on line 290

        Activity

        Hide
        Martin Dougiamas added a comment -

        From Urs Hunkler (u.hunkler at elearningkontor.de) Monday, 11 July 2005, 02:53 PM:

        I reverted the quiz module to a version from July, 4. 2005 an the cloze is working again. So the error sould be in the last updates.

        From Urs Hunkler (u.hunkler at elearningkontor.de) Monday, 11 July 2005, 05:24 PM:

        Addition:

        The report/item analysis produces this message with only one cloze in the test:

        Warning: array_multisort(): Argument #1 is expected to be an array or a sort flag in /var/home/v16235/www/elearningkontor.de/moodle-v15/mod/quiz/report/analysis/report.php on line 272

        Item Analysis Table

        From Urs Hunkler (u.hunkler at elearningkontor.de) Monday, 11 July 2005, 05:37 PM:

        Addition:

        With debug on I get this extended report:

        Notice: Undefined variable: index1 in /var/home/v16235/www/elearningkontor.de/moodle-v15/mod/quiz/report/analysis/report.php on line 272

        Notice: Undefined variable: index2 in /var/home/v16235/www/elearningkontor.de/moodle-v15/mod/quiz/report/analysis/report.php on line 272

        Warning: array_multisort(): Argument #1 is expected to be an array or a sort flag in /var/home/v16235/www/elearningkontor.de/moodle-v15/mod/quiz/report/analysis/report.php on line 272

        Item Analysis Table

        From Julian Sedding (jps502 at york.ac.uk) Monday, 11 July 2005, 05:56 PM:

        I cannot replicate the error described, so any information on the setup would be helpful (e.g. PHP version, database type and version, does the error only happen with old/new questions?)

        Most likely the bug only affects multichoice. All the other issues are a consequence thereof. In multichoice only the following (relevant) line has changed:

        if (!$question->options->answers = get_records('quiz_answers', 'question', $question->id)) {

        became:

        if (!$question->options->answers = get_records(quiz_answers,

        'question', $question->id, 'seq_number ASC')) {

        So maybe the ordering causes a problem, when the seq_number is '0' for all answer records (which would be the case for any old records)?

        From Urs Hunkler (u.hunkler at elearningkontor.de) Monday, 11 July 2005, 06:14 PM:

        First short answer:

        Unknown column 'seq_number' in 'order clause'

        SELECT * FROM mdl_15quiz_answers WHERE question = '32' ORDER BY seq_number ASC

        Error: Missing question answers!

        Unable to get options for questiontype 3 (id=32)

        Via phpmyadmin I don't see a field seq_number ???

        From Urs Hunkler (u.hunkler at elearningkontor.de) Monday, 11 July 2005, 06:23 PM:

        @Your questions

        we get the error on two servers - 1. with a Xampp instalation under windows, 2. is a linus computer.

        PHP version:

        1.

        System Windows NT MERCURIUS 5.0 build 2195

        Build Date Aug 12 2004 23:30:01

        2.

        System FreeBSD srv-011.terralink.de 5.2.1-RELEASE-p7 FreeBSD 5.2.1-RELEASE-p7 #0: Tue May 25 14:14:58 CEST 2004 root@srv-013.terralink.de:/usr/obj/usr/src/sys/GENERIC-686 i386

        Build Date Dec 21 2004 14:29:19

        database type and version

        1.

        mysql

        Client API version 3.23.57

        2.

        mysql

        Client API version 4.0.20

        MYSQL_MODULE_TYPE external

        does the error only happen with old/new questions?

        it happens with both old/new questions.

        From Urs Hunkler (u.hunkler at elearningkontor.de) Monday, 11 July 2005, 06:27 PM:

        Copy and paste left out the php versions - sorry:

        1. PHP Version 5.0.1

        2. PHP Version 4.3.10

        From Urs Hunkler (u.hunkler at elearningkontor.de) Monday, 11 July 2005, 06:42 PM:

        In mysql.sql in /quiz/db/ of the latest moodle version I don't see no field seq_number. Shouldn't it be generated there?

        – Table structure for table `prefix_quiz_answers`

        CREATE TABLE prefix_quiz_answers (

        id int(10) unsigned NOT NULL auto_increment,

        question int(10) unsigned NOT NULL default '0',

        answer text NOT NULL,

        fraction varchar(10) NOT NULL default '0.0',

        feedback text NOT NULL,

        PRIMARY KEY (id),

        KEY question (question)

        ) TYPE=MyISAM COMMENT='Answers, with a fractional grade (0-1) and feedback';

        – --------------------------------------------------------

        the field seq_number is only in the table quiz_states.

        Sorry, if I give stupid answers here. I try to help finding the bug, because we want to present the quizmodule this afternoon.

        From Urs Hunkler (u.hunkler at elearningkontor.de) Monday, 11 July 2005, 07:03 PM:

        If I set up a quiz with only one cloze question the item analysis only shows: Nothing to display. In a quiz analysis with more and different questions the cloze quize doesn't show up. All other questions are listed.

        From Urs Hunkler (u.hunkler at elearningkontor.de) Monday, 11 July 2005, 07:07 PM:

        In the Item Analysis Table the last column called Disc.

        Coeff. shows numbers like -999.00. From the help file I read the range is -1 to 1.

        From Jean_Michel Vedrine (jean-michel.vedrine at wanadoo.fr) Monday, 11 July 2005, 09:43 PM:

        The problem with item analysis is diiferent from the one you are having with cloze questions. The fact that cloze questions don't display in item analysis is quite normal, accepted qtypes for item analysis are SHORTANSWER, TRUEFALSE, MULTICHOICE, MATCH, NUMERICAL, CALCULATED. currently it is not possible to do item analysis for a cloze question.

        From Julian Sedding (jps502 at york.ac.uk) Thursday, 14 July 2005, 08:37 PM:

        Hi,

        thanks for all the responses! I have this field for development reasons in on my DB and forgot that it isn't in moodle yet. Sorry about that! In the meantime Gustav has implemented a fix for this issue, which should solve this problem.

        Julian

        From Gustav Delius (gwd2 at york.ac.uk) Thursday, 14 July 2005, 09:45 PM:

        Julian,

        are you sure that I removed all references to the seq_number field? Are you also sure that all code works even without the seq_number field?

        From Julian Sedding (jps502 at york.ac.uk) Tuesday, 2 August 2005, 09:52 PM:

        Yes, there was only one occurrence of the seq_number field, that could have caused a bug and that's removed.

        Fixed and closed.

        Show
        Martin Dougiamas added a comment - From Urs Hunkler (u.hunkler at elearningkontor.de) Monday, 11 July 2005, 02:53 PM: I reverted the quiz module to a version from July, 4. 2005 an the cloze is working again. So the error sould be in the last updates. From Urs Hunkler (u.hunkler at elearningkontor.de) Monday, 11 July 2005, 05:24 PM: Addition: The report/item analysis produces this message with only one cloze in the test: Warning: array_multisort(): Argument #1 is expected to be an array or a sort flag in /var/home/v16235/www/elearningkontor.de/ moodle-v15 /mod/quiz/report/analysis/report.php on line 272 Item Analysis Table From Urs Hunkler (u.hunkler at elearningkontor.de) Monday, 11 July 2005, 05:37 PM: Addition: With debug on I get this extended report: Notice: Undefined variable: index1 in /var/home/v16235/www/elearningkontor.de/ moodle-v15 /mod/quiz/report/analysis/report.php on line 272 Notice: Undefined variable: index2 in /var/home/v16235/www/elearningkontor.de/ moodle-v15 /mod/quiz/report/analysis/report.php on line 272 Warning: array_multisort(): Argument #1 is expected to be an array or a sort flag in /var/home/v16235/www/elearningkontor.de/ moodle-v15 /mod/quiz/report/analysis/report.php on line 272 Item Analysis Table From Julian Sedding (jps502 at york.ac.uk) Monday, 11 July 2005, 05:56 PM: I cannot replicate the error described, so any information on the setup would be helpful (e.g. PHP version, database type and version, does the error only happen with old/new questions?) Most likely the bug only affects multichoice. All the other issues are a consequence thereof. In multichoice only the following (relevant) line has changed: if (!$question->options->answers = get_records('quiz_answers', 'question', $question->id)) { became: if (!$question->options->answers = get_records(quiz_answers, 'question', $question->id, 'seq_number ASC')) { So maybe the ordering causes a problem, when the seq_number is '0' for all answer records (which would be the case for any old records)? From Urs Hunkler (u.hunkler at elearningkontor.de) Monday, 11 July 2005, 06:14 PM: First short answer: Unknown column 'seq_number' in 'order clause' SELECT * FROM mdl_15quiz_answers WHERE question = '32' ORDER BY seq_number ASC Error: Missing question answers! Unable to get options for questiontype 3 (id=32) Via phpmyadmin I don't see a field seq_number ??? From Urs Hunkler (u.hunkler at elearningkontor.de) Monday, 11 July 2005, 06:23 PM: @Your questions we get the error on two servers - 1. with a Xampp instalation under windows, 2. is a linus computer. PHP version: 1. System Windows NT MERCURIUS 5.0 build 2195 Build Date Aug 12 2004 23:30:01 2. System FreeBSD srv-011.terralink.de 5.2.1-RELEASE-p7 FreeBSD 5.2.1-RELEASE-p7 #0: Tue May 25 14:14:58 CEST 2004 root@srv-013.terralink.de:/usr/obj/usr/src/sys/GENERIC-686 i386 Build Date Dec 21 2004 14:29:19 database type and version 1. mysql Client API version 3.23.57 2. mysql Client API version 4.0.20 MYSQL_MODULE_TYPE external does the error only happen with old/new questions? it happens with both old/new questions. From Urs Hunkler (u.hunkler at elearningkontor.de) Monday, 11 July 2005, 06:27 PM: Copy and paste left out the php versions - sorry: 1. PHP Version 5.0.1 2. PHP Version 4.3.10 From Urs Hunkler (u.hunkler at elearningkontor.de) Monday, 11 July 2005, 06:42 PM: In mysql.sql in /quiz/db/ of the latest moodle version I don't see no field seq_number. Shouldn't it be generated there? – – Table structure for table `prefix_quiz_answers` – CREATE TABLE prefix_quiz_answers ( id int(10) unsigned NOT NULL auto_increment, question int(10) unsigned NOT NULL default '0', answer text NOT NULL, fraction varchar(10) NOT NULL default '0.0', feedback text NOT NULL, PRIMARY KEY (id), KEY question (question) ) TYPE=MyISAM COMMENT='Answers, with a fractional grade (0-1) and feedback'; – -------------------------------------------------------- the field seq_number is only in the table quiz_states. Sorry, if I give stupid answers here. I try to help finding the bug, because we want to present the quizmodule this afternoon. From Urs Hunkler (u.hunkler at elearningkontor.de) Monday, 11 July 2005, 07:03 PM: If I set up a quiz with only one cloze question the item analysis only shows: Nothing to display. In a quiz analysis with more and different questions the cloze quize doesn't show up. All other questions are listed. From Urs Hunkler (u.hunkler at elearningkontor.de) Monday, 11 July 2005, 07:07 PM: In the Item Analysis Table the last column called Disc. Coeff. shows numbers like -999.00. From the help file I read the range is -1 to 1. From Jean_Michel Vedrine (jean-michel.vedrine at wanadoo.fr) Monday, 11 July 2005, 09:43 PM: The problem with item analysis is diiferent from the one you are having with cloze questions. The fact that cloze questions don't display in item analysis is quite normal, accepted qtypes for item analysis are SHORTANSWER, TRUEFALSE, MULTICHOICE, MATCH, NUMERICAL, CALCULATED. currently it is not possible to do item analysis for a cloze question. From Julian Sedding (jps502 at york.ac.uk) Thursday, 14 July 2005, 08:37 PM: Hi, thanks for all the responses! I have this field for development reasons in on my DB and forgot that it isn't in moodle yet. Sorry about that! In the meantime Gustav has implemented a fix for this issue, which should solve this problem. Julian From Gustav Delius (gwd2 at york.ac.uk) Thursday, 14 July 2005, 09:45 PM: Julian, are you sure that I removed all references to the seq_number field? Are you also sure that all code works even without the seq_number field? From Julian Sedding (jps502 at york.ac.uk) Tuesday, 2 August 2005, 09:52 PM: Yes, there was only one occurrence of the seq_number field, that could have caused a bug and that's removed. Fixed and closed.
        Hide
        Michael Blake added a comment -

        assign to a valid user

        Show
        Michael Blake added a comment - assign to a valid user
        Hide
        Michael Blake added a comment -

        assign to a valid user

        Show
        Michael Blake added a comment - assign to a valid user

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: