Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/question/type/multianswer/db/simpletest/testupgradelibnewqe.php
Go to the documentation of this file.
00001 <?php
00002 // This file is part of Moodle - http://moodle.org/
00003 //
00004 // Moodle is free software: you can redistribute it and/or modify
00005 // it under the terms of the GNU General Public License as published by
00006 // the Free Software Foundation, either version 3 of the License, or
00007 // (at your option) any later version.
00008 //
00009 // Moodle is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00016 
00028 defined('MOODLE_INTERNAL') || die();
00029 
00030 require_once($CFG->dirroot . '/question/engine/upgrade/simpletest/helper.php');
00031 
00032 
00039 class qtype_multianswer_attempt_upgrader_test extends question_attempt_upgrader_test_base {
00040     public function test_multianswer_adaptivenopenalty_qsession104() {
00041         $quiz = (object) array(
00042             'id' => '5',
00043             'course' => '2',
00044             'name' => 'Multianswer quiz',
00045             'intro' => '',
00046             'introformat' => '1',
00047             'timeopen' => '0',
00048             'timeclose' => '0',
00049             'attempts' => '0',
00050             'attemptonlast' => '0',
00051             'grademethod' => '1',
00052             'decimalpoints' => '2',
00053             'questiondecimalpoints' => '-1',
00054             'review' => '4459503',
00055             'questionsperpage' => '1',
00056             'shufflequestions' => '0',
00057             'shuffleanswers' => '1',
00058             'questions' => '28,19,0',
00059             'sumgrades' => '14.00000',
00060             'grade' => '10.00000',
00061             'timecreated' => '0',
00062             'timemodified' => '1306424728',
00063             'timelimit' => '0',
00064             'password' => '',
00065             'subnet' => '',
00066             'popup' => '0',
00067             'delay1' => '0',
00068             'delay2' => '0',
00069             'showuserpicture' => '0',
00070             'showblocks' => '0',
00071             'preferredbehaviour' => 'adaptivenopenalty',
00072         );
00073         $attempt = (object) array(
00074             'id' => '16',
00075             'uniqueid' => '16',
00076             'quiz' => '5',
00077             'userid' => '4',
00078             'attempt' => '1',
00079             'sumgrades' => '6.00000',
00080             'timestart' => '1306425691',
00081             'timefinish' => '1306425746',
00082             'timemodified' => '1306425746',
00083             'layout' => '28,19,0',
00084             'preview' => '0',
00085             'needsupgradetonewqe' => 1,
00086         );
00087         $question = (object) array(
00088             'id' => '28',
00089             'category' => '2',
00090             'parent' => '0',
00091             'name' => 'Very simple cloze',
00092             'questiontext' => '<p>An answer {#1}.</p>',
00093             'questiontextformat' => '1',
00094             'generalfeedback' => '',
00095             'generalfeedbackformat' => '1',
00096             'penalty' => '0.1000000',
00097             'qtype' => 'multianswer',
00098             'length' => '1',
00099             'stamp' => 'tjh238.vledev2.open.ac.uk+110526154631+XQLcXi',
00100             'version' => 'tjh238.vledev2.open.ac.uk+110526154631+T8hPiI',
00101             'hidden' => '0',
00102             'timecreated' => '1306424791',
00103             'timemodified' => '1306424791',
00104             'createdby' => '2',
00105             'modifiedby' => '2',
00106             'maxmark' => '1.0000000',
00107             'options' => (object) array(
00108                 'questions' => array(
00109                     1 => (object) array(
00110                         'id' => '29',
00111                         'category' => '2',
00112                         'parent' => '28',
00113                         'name' => 'Very simple cloze',
00114                         'questiontext' => '{1:SHORTANSWER:=frog#Yay!}',
00115                         'questiontextformat' => '0',
00116                         'generalfeedback' => '',
00117                         'generalfeedbackformat' => '1',
00118                         'defaultgrade' => '1.0000000',
00119                         'penalty' => '0.0000000',
00120                         'qtype' => 'shortanswer',
00121                         'length' => '1',
00122                         'stamp' => 'tjh238.vledev2.open.ac.uk+110526154631+j3BYTL',
00123                         'version' => 'tjh238.vledev2.open.ac.uk+110526154631+lxNwQv',
00124                         'hidden' => '0',
00125                         'timecreated' => '1306424791',
00126                         'timemodified' => '1306424791',
00127                         'createdby' => '2',
00128                         'modifiedby' => '2',
00129                         'options' => (object) array(
00130                             'answers' => array(
00131                                 52 => (object) array(
00132                                     'id' => '52',
00133                                     'question' => '29',
00134                                     'answer' => 'frog',
00135                                     'answerformat' => '0',
00136                                     'fraction' => '1.0000000',
00137                                     'feedback' => 'Yay!',
00138                                     'feedbackformat' => '1',
00139                                 ),
00140                             ),
00141                             'usecase' => '0',
00142                         ),
00143                         'maxgrade' => '1.0000000',
00144                     ),
00145                 ),
00146             ),
00147             'defaultmark' => '1.0000000',
00148         );
00149         $qsession = (object) array(
00150             'id' => '104',
00151             'attemptid' => '16',
00152             'questionid' => '28',
00153             'newest' => '285',
00154             'newgraded' => '285',
00155             'sumpenalty' => '0.1000000',
00156             'manualcomment' => '',
00157             'manualcommentformat' => '1',
00158             'flagged' => '0',
00159         );
00160         $qstates = array(
00161             281 => (object) array(
00162                 'id' => '281',
00163                 'attempt' => '16',
00164                 'question' => '28',
00165                 'seq_number' => '0',
00166                 'answer' => '1-',
00167                 'timestamp' => '1306425691',
00168                 'event' => '0',
00169                 'grade' => '0.0000000',
00170                 'raw_grade' => '0.0000000',
00171                 'penalty' => '0.0000000',
00172             ),
00173             283 => (object) array(
00174                 'id' => '283',
00175                 'attempt' => '16',
00176                 'question' => '28',
00177                 'seq_number' => '1',
00178                 'answer' => '1-frog',
00179                 'timestamp' => '1306425739',
00180                 'event' => '2',
00181                 'grade' => '0.0000000',
00182                 'raw_grade' => '1.0000000',
00183                 'penalty' => '0.1000000',
00184             ),
00185             285 => (object) array(
00186                 'id' => '285',
00187                 'attempt' => '16',
00188                 'question' => '28',
00189                 'seq_number' => '2',
00190                 'answer' => '1-frog',
00191                 'timestamp' => '1306425739',
00192                 'event' => '6',
00193                 'grade' => '1.0000000',
00194                 'raw_grade' => '1.0000000',
00195                 'penalty' => '0.1000000',
00196             ),
00197         );
00198 
00199         $qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates);
00200 
00201         $expectedqa = (object) array(
00202             'behaviour' => 'adaptivenopenalty',
00203             'questionid' => 28,
00204             'variant' => 1,
00205             'maxmark' => 1.0000000,
00206             'minfraction' => 0,
00207             'flagged' => 0,
00208             'questionsummary' => 'An answer _____.',
00209             'rightanswer' => 'part 1: frog',
00210             'responsesummary' => 'part 1: frog',
00211             'timemodified' => 1306425739,
00212             'steps' => array(
00213                 0 => (object) array(
00214                     'sequencenumber' => 0,
00215                     'state' => 'todo',
00216                     'fraction' => null,
00217                     'timecreated' => 1306425691,
00218                     'userid' => 4,
00219                     'data' => array(),
00220                 ),
00221                 1 => (object) array(
00222                     'sequencenumber' => 1,
00223                     'state' => 'complete',
00224                     'fraction' => null,
00225                     'timecreated' => 1306425739,
00226                     'userid' => 4,
00227                     'data' => array('sub1_answer' => 'frog'),
00228                 ),
00229                 2 => (object) array(
00230                     'sequencenumber' => 2,
00231                     'state' => 'gradedright',
00232                     'fraction' => 1.0,
00233                     'timecreated' => 1306425739,
00234                     'userid' => 4,
00235                     'data' => array('sub1_answer' => 'frog', '-finish' => '1',
00236                             '-_try' => '1', '-_rawfraction' => 1.0),
00237                 ),
00238             ),
00239         );
00240 
00241         $this->compare_qas($expectedqa, $qa);
00242     }
00243 
00244     public function test_multianswer_adaptivenopenalty_qsession106() {
00245         $quiz = (object) array(
00246             'id' => '5',
00247             'course' => '2',
00248             'name' => 'Multianswer quiz',
00249             'intro' => '',
00250             'introformat' => '1',
00251             'timeopen' => '0',
00252             'timeclose' => '0',
00253             'attempts' => '0',
00254             'attemptonlast' => '0',
00255             'grademethod' => '1',
00256             'decimalpoints' => '2',
00257             'questiondecimalpoints' => '-1',
00258             'review' => '4459503',
00259             'questionsperpage' => '1',
00260             'shufflequestions' => '0',
00261             'shuffleanswers' => '1',
00262             'questions' => '28,19,0',
00263             'sumgrades' => '14.00000',
00264             'grade' => '10.00000',
00265             'timecreated' => '0',
00266             'timemodified' => '1306424728',
00267             'timelimit' => '0',
00268             'password' => '',
00269             'subnet' => '',
00270             'popup' => '0',
00271             'delay1' => '0',
00272             'delay2' => '0',
00273             'showuserpicture' => '0',
00274             'showblocks' => '0',
00275             'preferredbehaviour' => 'adaptivenopenalty',
00276         );
00277         $attempt = (object) array(
00278             'id' => '17',
00279             'uniqueid' => '17',
00280             'quiz' => '5',
00281             'userid' => '4',
00282             'attempt' => '2',
00283             'sumgrades' => '0.00000',
00284             'timestart' => '1306425757',
00285             'timefinish' => '1306425762',
00286             'timemodified' => '1306425762',
00287             'layout' => '28,19,0',
00288             'preview' => '0',
00289             'needsupgradetonewqe' => 1,
00290         );
00291         $question = (object) array(
00292             'id' => '28',
00293             'category' => '2',
00294             'parent' => '0',
00295             'name' => 'Very simple cloze',
00296             'questiontext' => '<p>An answer {#1}.</p>',
00297             'questiontextformat' => '1',
00298             'generalfeedback' => '',
00299             'generalfeedbackformat' => '1',
00300             'penalty' => '0.1000000',
00301             'qtype' => 'multianswer',
00302             'length' => '1',
00303             'stamp' => 'tjh238.vledev2.open.ac.uk+110526154631+XQLcXi',
00304             'version' => 'tjh238.vledev2.open.ac.uk+110526154631+T8hPiI',
00305             'hidden' => '0',
00306             'timecreated' => '1306424791',
00307             'timemodified' => '1306424791',
00308             'createdby' => '2',
00309             'modifiedby' => '2',
00310             'maxmark' => '1.0000000',
00311             'options' => (object) array(
00312                 'questions' => array(
00313                     1 => (object) array(
00314                         'id' => '29',
00315                         'category' => '2',
00316                         'parent' => '28',
00317                         'name' => 'Very simple cloze',
00318                         'questiontext' => '{1:SHORTANSWER:=frog#Yay!}',
00319                         'questiontextformat' => '0',
00320                         'generalfeedback' => '',
00321                         'generalfeedbackformat' => '1',
00322                         'defaultgrade' => '1.0000000',
00323                         'penalty' => '0.0000000',
00324                         'qtype' => 'shortanswer',
00325                         'length' => '1',
00326                         'stamp' => 'tjh238.vledev2.open.ac.uk+110526154631+j3BYTL',
00327                         'version' => 'tjh238.vledev2.open.ac.uk+110526154631+lxNwQv',
00328                         'hidden' => '0',
00329                         'timecreated' => '1306424791',
00330                         'timemodified' => '1306424791',
00331                         'createdby' => '2',
00332                         'modifiedby' => '2',
00333                         'options' => (object) array(
00334                             'answers' => array(
00335                                 52 => (object) array(
00336                                     'id' => '52',
00337                                     'question' => '29',
00338                                     'answer' => 'frog',
00339                                     'answerformat' => '0',
00340                                     'fraction' => '1.0000000',
00341                                     'feedback' => 'Yay!',
00342                                     'feedbackformat' => '1',
00343                                 ),
00344                             ),
00345                             'usecase' => '0',
00346                         ),
00347                         'maxgrade' => '1.0000000',
00348                     ),
00349                 ),
00350             ),
00351             'defaultmark' => '1.0000000',
00352         );
00353         $qsession = (object) array(
00354             'id' => '106',
00355             'attemptid' => '17',
00356             'questionid' => '28',
00357             'newest' => '289',
00358             'newgraded' => '289',
00359             'sumpenalty' => '0.1000000',
00360             'manualcomment' => '',
00361             'manualcommentformat' => '1',
00362             'flagged' => '0',
00363         );
00364         $qstates = array(
00365             287 => (object) array(
00366                 'id' => '287',
00367                 'attempt' => '17',
00368                 'question' => '28',
00369                 'seq_number' => '0',
00370                 'answer' => '1-',
00371                 'timestamp' => '1306425757',
00372                 'event' => '0',
00373                 'grade' => '0.0000000',
00374                 'raw_grade' => '0.0000000',
00375                 'penalty' => '0.0000000',
00376             ),
00377             289 => (object) array(
00378                 'id' => '289',
00379                 'attempt' => '17',
00380                 'question' => '28',
00381                 'seq_number' => '1',
00382                 'answer' => '1-',
00383                 'timestamp' => '1306425757',
00384                 'event' => '6',
00385                 'grade' => '0.0000000',
00386                 'raw_grade' => '0.0000000',
00387                 'penalty' => '0.1000000',
00388             ),
00389         );
00390 
00391         $qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates);
00392 
00393         $expectedqa = (object) array(
00394             'behaviour' => 'adaptivenopenalty',
00395             'questionid' => 28,
00396             'variant' => 1,
00397             'maxmark' => 1.0000000,
00398             'minfraction' => 0,
00399             'flagged' => 0,
00400             'questionsummary' => 'An answer _____.',
00401             'rightanswer' => 'part 1: frog',
00402             'responsesummary' => 'part 1: ',
00403             'timemodified' => 1306425757,
00404             'steps' => array(
00405                 0 => (object) array(
00406                     'sequencenumber' => 0,
00407                     'state' => 'todo',
00408                     'fraction' => null,
00409                     'timecreated' => 1306425757,
00410                     'userid' => 4,
00411                     'data' => array(),
00412                 ),
00413                 1 => (object) array(
00414                     'sequencenumber' => 1,
00415                     'state' => 'gradedwrong',
00416                     'fraction' => 0.0,
00417                     'timecreated' => 1306425757,
00418                     'userid' => 4,
00419                     'data' => array('-finish' => '1', '-_try' => '1', '-_rawfraction' => 0.0),
00420                 ),
00421             ),
00422         );
00423 
00424         $this->compare_qas($expectedqa, $qa);
00425     }
00426 
00427     public function test_multianswer_adaptivenopenalty_qsession108() {
00428         $quiz = (object) array(
00429             'id' => '5',
00430             'course' => '2',
00431             'name' => 'Multianswer quiz',
00432             'intro' => '',
00433             'introformat' => '1',
00434             'timeopen' => '0',
00435             'timeclose' => '0',
00436             'attempts' => '0',
00437             'attemptonlast' => '0',
00438             'grademethod' => '1',
00439             'decimalpoints' => '2',
00440             'questiondecimalpoints' => '-1',
00441             'review' => '4459503',
00442             'questionsperpage' => '1',
00443             'shufflequestions' => '0',
00444             'shuffleanswers' => '1',
00445             'questions' => '28,19,0',
00446             'sumgrades' => '14.00000',
00447             'grade' => '10.00000',
00448             'timecreated' => '0',
00449             'timemodified' => '1306424728',
00450             'timelimit' => '0',
00451             'password' => '',
00452             'subnet' => '',
00453             'popup' => '0',
00454             'delay1' => '0',
00455             'delay2' => '0',
00456             'showuserpicture' => '0',
00457             'showblocks' => '0',
00458             'preferredbehaviour' => 'adaptivenopenalty',
00459         );
00460         $attempt = (object) array(
00461             'id' => '18',
00462             'uniqueid' => '18',
00463             'quiz' => '5',
00464             'userid' => '3',
00465             'attempt' => '1',
00466             'sumgrades' => '10.40000',
00467             'timestart' => '1306425784',
00468             'timefinish' => '1306425931',
00469             'timemodified' => '1306425931',
00470             'layout' => '28,19,0',
00471             'preview' => '0',
00472             'needsupgradetonewqe' => 1,
00473         );
00474         $question = (object) array(
00475             'id' => '28',
00476             'category' => '2',
00477             'parent' => '0',
00478             'name' => 'Very simple cloze',
00479             'questiontext' => '<p>An answer {#1}.</p>',
00480             'questiontextformat' => '1',
00481             'generalfeedback' => '',
00482             'generalfeedbackformat' => '1',
00483             'penalty' => '0.1000000',
00484             'qtype' => 'multianswer',
00485             'length' => '1',
00486             'stamp' => 'tjh238.vledev2.open.ac.uk+110526154631+XQLcXi',
00487             'version' => 'tjh238.vledev2.open.ac.uk+110526154631+T8hPiI',
00488             'hidden' => '0',
00489             'timecreated' => '1306424791',
00490             'timemodified' => '1306424791',
00491             'createdby' => '2',
00492             'modifiedby' => '2',
00493             'maxmark' => '1.0000000',
00494             'options' => (object) array(
00495                 'questions' => array(
00496                     1 => (object) array(
00497                         'id' => '29',
00498                         'category' => '2',
00499                         'parent' => '28',
00500                         'name' => 'Very simple cloze',
00501                         'questiontext' => '{1:SHORTANSWER:=frog#Yay!}',
00502                         'questiontextformat' => '0',
00503                         'generalfeedback' => '',
00504                         'generalfeedbackformat' => '1',
00505                         'defaultgrade' => '1.0000000',
00506                         'penalty' => '0.0000000',
00507                         'qtype' => 'shortanswer',
00508                         'length' => '1',
00509                         'stamp' => 'tjh238.vledev2.open.ac.uk+110526154631+j3BYTL',
00510                         'version' => 'tjh238.vledev2.open.ac.uk+110526154631+lxNwQv',
00511                         'hidden' => '0',
00512                         'timecreated' => '1306424791',
00513                         'timemodified' => '1306424791',
00514                         'createdby' => '2',
00515                         'modifiedby' => '2',
00516                         'options' => (object) array(
00517                             'answers' => array(
00518                                 52 => (object) array(
00519                                     'id' => '52',
00520                                     'question' => '29',
00521                                     'answer' => 'frog',
00522                                     'answerformat' => '0',
00523                                     'fraction' => '1.0000000',
00524                                     'feedback' => 'Yay!',
00525                                     'feedbackformat' => '1',
00526                                 ),
00527                             ),
00528                             'usecase' => '0',
00529                         ),
00530                         'maxgrade' => '1.0000000',
00531                     ),
00532                 ),
00533             ),
00534             'defaultmark' => '1.0000000',
00535         );
00536         $qsession = (object) array(
00537             'id' => '108',
00538             'attemptid' => '18',
00539             'questionid' => '28',
00540             'newest' => '298',
00541             'newgraded' => '298',
00542             'sumpenalty' => '0.2000000',
00543             'manualcomment' => '',
00544             'manualcommentformat' => '1',
00545             'flagged' => '0',
00546         );
00547         $qstates = array(
00548             291 => (object) array(
00549                 'id' => '291',
00550                 'attempt' => '18',
00551                 'question' => '28',
00552                 'seq_number' => '0',
00553                 'answer' => '1-',
00554                 'timestamp' => '1306425784',
00555                 'event' => '0',
00556                 'grade' => '0.0000000',
00557                 'raw_grade' => '0.0000000',
00558                 'penalty' => '0.0000000',
00559             ),
00560             293 => (object) array(
00561                 'id' => '293',
00562                 'attempt' => '18',
00563                 'question' => '28',
00564                 'seq_number' => '1',
00565                 'answer' => '1-ds&#0044;&#0045;afg',
00566                 'timestamp' => '1306425801',
00567                 'event' => '2',
00568                 'grade' => '0.0000000',
00569                 'raw_grade' => '0.0000000',
00570                 'penalty' => '0.1000000',
00571             ),
00572             297 => (object) array(
00573                 'id' => '297',
00574                 'attempt' => '18',
00575                 'question' => '28',
00576                 'seq_number' => '2',
00577                 'answer' => '1-frog',
00578                 'timestamp' => '1306425917',
00579                 'event' => '3',
00580                 'grade' => '1.0000000',
00581                 'raw_grade' => '1.0000000',
00582                 'penalty' => '0.1000000',
00583             ),
00584             298 => (object) array(
00585                 'id' => '298',
00586                 'attempt' => '18',
00587                 'question' => '28',
00588                 'seq_number' => '3',
00589                 'answer' => '1-frog',
00590                 'timestamp' => '1306425917',
00591                 'event' => '6',
00592                 'grade' => '1.0000000',
00593                 'raw_grade' => '1.0000000',
00594                 'penalty' => '0.1000000',
00595             ),
00596         );
00597 
00598         $qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates);
00599 
00600         $expectedqa = (object) array(
00601             'behaviour' => 'adaptivenopenalty',
00602             'questionid' => 28,
00603             'variant' => 1,
00604             'maxmark' => 1.0000000,
00605             'minfraction' => 0,
00606             'flagged' => 0,
00607             'questionsummary' => 'An answer _____.',
00608             'rightanswer' => 'part 1: frog',
00609             'responsesummary' => 'part 1: frog',
00610             'timemodified' => 1306425917,
00611             'steps' => array(
00612                 0 => (object) array(
00613                     'sequencenumber' => 0,
00614                     'state' => 'todo',
00615                     'fraction' => null,
00616                     'timecreated' => 1306425784,
00617                     'userid' => 3,
00618                     'data' => array(),
00619                 ),
00620                 1 => (object) array(
00621                     'sequencenumber' => 1,
00622                     'state' => 'complete',
00623                     'fraction' => null,
00624                     'timecreated' => 1306425801,
00625                     'userid' => 3,
00626                     'data' => array('sub1_answer' => 'ds,-afg'),
00627                 ),
00628                 2 => (object) array(
00629                     'sequencenumber' => 2,
00630                     'state' => 'complete',
00631                     'fraction' => 1,
00632                     'timecreated' => 1306425917,
00633                     'userid' => 3,
00634                     'data' => array('sub1_answer' => 'frog', '-_try' => 1,
00635                             '-_rawfraction' => 1.0, '-submit' => 1),
00636                 ),
00637                 3 => (object) array(
00638                     'sequencenumber' => 3,
00639                     'state' => 'gradedright',
00640                     'fraction' => 1,
00641                     'timecreated' => 1306425917,
00642                     'userid' => 3,
00643                     'data' => array('sub1_answer' => 'frog', '-_try' => 1,
00644                             '-_rawfraction' => 1.0, '-finish' => 1),
00645                 ),
00646             ),
00647         );
00648 
00649         $this->compare_qas($expectedqa, $qa);
00650     }
00651 
00652     public function test_multianswer_adaptivenopenalty_qsession105() {
00653         $quiz = (object) array(
00654             'id' => '5',
00655             'course' => '2',
00656             'name' => 'Multianswer quiz',
00657             'intro' => '',
00658             'introformat' => '1',
00659             'timeopen' => '0',
00660             'timeclose' => '0',
00661             'attempts' => '0',
00662             'attemptonlast' => '0',
00663             'grademethod' => '1',
00664             'decimalpoints' => '2',
00665             'questiondecimalpoints' => '-1',
00666             'review' => '4459503',
00667             'questionsperpage' => '1',
00668             'shufflequestions' => '0',
00669             'shuffleanswers' => '1',
00670             'questions' => '28,19,0',
00671             'sumgrades' => '14.00000',
00672             'grade' => '10.00000',
00673             'timecreated' => '0',
00674             'timemodified' => '1306424728',
00675             'timelimit' => '0',
00676             'password' => '',
00677             'subnet' => '',
00678             'popup' => '0',
00679             'delay1' => '0',
00680             'delay2' => '0',
00681             'showuserpicture' => '0',
00682             'showblocks' => '0',
00683             'preferredbehaviour' => 'adaptivenopenalty',
00684         );
00685         $attempt = (object) array(
00686             'id' => '16',
00687             'uniqueid' => '16',
00688             'quiz' => '5',
00689             'userid' => '4',
00690             'attempt' => '1',
00691             'sumgrades' => '6.00000',
00692             'timestart' => '1306425691',
00693             'timefinish' => '1306425746',
00694             'timemodified' => '1306425746',
00695             'layout' => '28,19,0',
00696             'preview' => '0',
00697             'needsupgradetonewqe' => 1,
00698         );
00699         $question = (object) array(
00700             'id' => '19',
00701             'category' => '2',
00702             'parent' => '0',
00703             'name' => 'Cloze',
00704             'questiontext' => '<p>This question consists of some text with an answer embedded right  here {#1}</p>
00705         <p>and right after that you will have to deal with this short answer  {#2}</p>
00706         <p>and finally we have a floating point number  {#3}.</p>
00707         <p>The  multichoice question can also be shown in the vertical  display of the standard moodle multiple choice. {#4}</p>
00708         <p>Or in an horizontal display that is included here in a table {#5}</p>
00709         <p>A shortanswer question where case must match. Write moodle in  upper case letters {#6}</p>
00710         <p>Note that addresses like www.moodle.org and smileys :-) all work as normal:</p>
00711         <p>a) How good is this? {#7}</p>
00712         <p>b) What grade would you give it? {#8}</p>',
00713             'questiontextformat' => '1',
00714             'generalfeedback' => '',
00715             'generalfeedbackformat' => '1',
00716             'penalty' => '0.1000000',
00717             'qtype' => 'multianswer',
00718             'length' => '1',
00719             'stamp' => 'tjh238.vledev2.open.ac.uk+110525164438+iwiint',
00720             'version' => 'tjh238.vledev2.open.ac.uk+110525164441+AAjnIy',
00721             'hidden' => '0',
00722             'timecreated' => '1306341878',
00723             'timemodified' => '1306341879',
00724             'createdby' => '2',
00725             'modifiedby' => '2',
00726             'maxmark' => '13.0000000',
00727             'options' => (object) array(
00728                 'questions' => array(
00729                     1 => (object) array(
00730                         'id' => '20',
00731                         'category' => '2',
00732                         'parent' => '19',
00733                         'name' => 'Cloze',
00734                         'questiontext' => '{1:MULTICHOICE:Wrong answer#Feedback for this wrong answer~Another  wrong answer#Feedback for the other wrong answer~=Correct  answer#Feedback for correct answer~%50%Answer that gives half the  credit#Feedback for half credit answer}',
00735                         'questiontextformat' => '0',
00736                         'generalfeedback' => '',
00737                         'generalfeedbackformat' => '1',
00738                         'defaultgrade' => '1.0000000',
00739                         'penalty' => '0.0000000',
00740                         'qtype' => 'multichoice',
00741                         'length' => '1',
00742                         'stamp' => 'tjh238.vledev2.open.ac.uk+110525164439+cAuJ4r',
00743                         'version' => 'tjh238.vledev2.open.ac.uk+110525164439+5bnnys',
00744                         'hidden' => '0',
00745                         'timecreated' => '1306341879',
00746                         'timemodified' => '1306341879',
00747                         'createdby' => '2',
00748                         'modifiedby' => '2',
00749                         'options' => (object) array(
00750                             'id' => '3',
00751                             'question' => '20',
00752                             'layout' => '0',
00753                             'answers' => array(
00754                                 29 => (object) array(
00755                                     'id' => '29',
00756                                     'question' => '20',
00757                                     'answer' => 'Wrong answer',
00758                                     'answerformat' => '1',
00759                                     'fraction' => '0.0000000',
00760                                     'feedback' => 'Feedback for this wrong answer',
00761                                     'feedbackformat' => '1',
00762                                 ),
00763                                 30 => (object) array(
00764                                     'id' => '30',
00765                                     'question' => '20',
00766                                     'answer' => 'Another  wrong answer',
00767                                     'answerformat' => '1',
00768                                     'fraction' => '0.0000000',
00769                                     'feedback' => 'Feedback for the other wrong answer',
00770                                     'feedbackformat' => '1',
00771                                 ),
00772                                 31 => (object) array(
00773                                     'id' => '31',
00774                                     'question' => '20',
00775                                     'answer' => 'Correct  answer',
00776                                     'answerformat' => '1',
00777                                     'fraction' => '1.0000000',
00778                                     'feedback' => 'Feedback for correct answer',
00779                                     'feedbackformat' => '1',
00780                                 ),
00781                                 32 => (object) array(
00782                                     'id' => '32',
00783                                     'question' => '20',
00784                                     'answer' => 'Answer that gives half the  credit',
00785                                     'answerformat' => '1',
00786                                     'fraction' => '0.5000000',
00787                                     'feedback' => 'Feedback for half credit answer',
00788                                     'feedbackformat' => '1',
00789                                 ),
00790                             ),
00791                             'single' => '1',
00792                             'shuffleanswers' => '1',
00793                             'correctfeedback' => '',
00794                             'correctfeedbackformat' => '1',
00795                             'partiallycorrectfeedback' => '',
00796                             'partiallycorrectfeedbackformat' => '1',
00797                             'incorrectfeedback' => '',
00798                             'incorrectfeedbackformat' => '1',
00799                             'answernumbering' => '0',
00800                         ),
00801                         'maxgrade' => '1.0000000',
00802                     ),
00803                     2 => (object) array(
00804                         'id' => '21',
00805                         'category' => '2',
00806                         'parent' => '19',
00807                         'name' => 'Cloze',
00808                         'questiontext' => '{1:SHORTANSWER:Wrong answer#Feedback for this wrong answer~=Correct  answer#Feedback for correct answer~%50%Answer that gives half the  credit#Feedback for half credit answer}',
00809                         'questiontextformat' => '0',
00810                         'generalfeedback' => '',
00811                         'generalfeedbackformat' => '1',
00812                         'defaultgrade' => '1.0000000',
00813                         'penalty' => '0.0000000',
00814                         'qtype' => 'shortanswer',
00815                         'length' => '1',
00816                         'stamp' => 'tjh238.vledev2.open.ac.uk+110525164440+EN6wCk',
00817                         'version' => 'tjh238.vledev2.open.ac.uk+110525164440+bQzatI',
00818                         'hidden' => '0',
00819                         'timecreated' => '1306341880',
00820                         'timemodified' => '1306341880',
00821                         'createdby' => '2',
00822                         'modifiedby' => '2',
00823                         'options' => (object) array(
00824                             'answers' => array(
00825                                 33 => (object) array(
00826                                     'id' => '33',
00827                                     'question' => '21',
00828                                     'answer' => 'Wrong answer',
00829                                     'answerformat' => '0',
00830                                     'fraction' => '0.0000000',
00831                                     'feedback' => 'Feedback for this wrong answer',
00832                                     'feedbackformat' => '1',
00833                                 ),
00834                                 34 => (object) array(
00835                                     'id' => '34',
00836                                     'question' => '21',
00837                                     'answer' => 'Correct  answer',
00838                                     'answerformat' => '0',
00839                                     'fraction' => '1.0000000',
00840                                     'feedback' => 'Feedback for correct answer',
00841                                     'feedbackformat' => '1',
00842                                 ),
00843                                 35 => (object) array(
00844                                     'id' => '35',
00845                                     'question' => '21',
00846                                     'answer' => 'Answer that gives half the  credit',
00847                                     'answerformat' => '0',
00848                                     'fraction' => '0.5000000',
00849                                     'feedback' => 'Feedback for half credit answer',
00850                                     'feedbackformat' => '1',
00851                                 ),
00852                             ),
00853                             'usecase' => '0',
00854                         ),
00855                         'maxgrade' => '1.0000000',
00856                     ),
00857                     3 => (object) array(
00858                         'id' => '22',
00859                         'category' => '2',
00860                         'parent' => '19',
00861                         'name' => 'Cloze',
00862                         'questiontext' => '{2:NUMERICAL:=23.8:0.1#Feedback for correct answer  23.8~%50%23.8:2#Feedback for half credit answer in the nearby region of  the correct answer}',
00863                         'questiontextformat' => '0',
00864                         'generalfeedback' => '',
00865                         'generalfeedbackformat' => '1',
00866                         'defaultgrade' => '2.0000000',
00867                         'penalty' => '0.0000000',
00868                         'qtype' => 'numerical',
00869                         'length' => '1',
00870                         'stamp' => 'tjh238.vledev2.open.ac.uk+110525164440+Xr29c2',
00871                         'version' => 'tjh238.vledev2.open.ac.uk+110525164441+QTwsGM',
00872                         'hidden' => '0',
00873                         'timecreated' => '1306341880',
00874                         'timemodified' => '1306341880',
00875                         'createdby' => '2',
00876                         'modifiedby' => '2',
00877                         'options' => (object) array(
00878                             'answers' => array(
00879                                 36 => (object) array(
00880                                     'id' => '36',
00881                                     'question' => '22',
00882                                     'answer' => '23.8',
00883                                     'answerformat' => '0',
00884                                     'fraction' => '1.0000000',
00885                                     'feedback' => 'Feedback for correct answer  23.8',
00886                                     'feedbackformat' => '1',
00887                                     'tolerance' => '0.1',
00888                                 ),
00889                                 37 => (object) array(
00890                                     'id' => '37',
00891                                     'question' => '22',
00892                                     'answer' => '23.8',
00893                                     'answerformat' => '0',
00894                                     'fraction' => '0.5000000',
00895                                     'feedback' => 'Feedback for half credit answer in the nearby region of  the correct answer',
00896                                     'feedbackformat' => '1',
00897                                     'tolerance' => '2',
00898                                 ),
00899                             ),
00900                             'units' => array(
00901                             ),
00902                             'unitgradingtype' => '0',
00903                             'unitpenalty' => '1.0000000',
00904                             'showunits' => '3',
00905                             'unitsleft' => '0',
00906                             'instructions' => '',
00907                             'instructionsformat' => '1',
00908                         ),
00909                         'maxgrade' => '2.0000000',
00910                     ),
00911                     4 => (object) array(
00912                         'id' => '23',
00913                         'category' => '2',
00914                         'parent' => '19',
00915                         'name' => 'Cloze',
00916                         'questiontext' => '{2:MCV:1. Wrong answer#Feedback for this wrong answer~2. Another wrong  answer#Feedback for the other wrong answer~=3. Correct answer#Feedback  for correct answer~%50%4. Answer that gives half the credit#Feedback for  half credit answer}',
00917                         'questiontextformat' => '0',
00918                         'generalfeedback' => '',
00919                         'generalfeedbackformat' => '1',
00920                         'defaultgrade' => '2.0000000',
00921                         'penalty' => '0.0000000',
00922                         'qtype' => 'multichoice',
00923                         'length' => '1',
00924                         'stamp' => 'tjh238.vledev2.open.ac.uk+110525164441+7R55HA',
00925                         'version' => 'tjh238.vledev2.open.ac.uk+110525164441+uCMoQc',
00926                         'hidden' => '0',
00927                         'timecreated' => '1306341881',
00928                         'timemodified' => '1306341881',
00929                         'createdby' => '2',
00930                         'modifiedby' => '2',
00931                         'options' => (object) array(
00932                             'id' => '4',
00933                             'question' => '23',
00934                             'layout' => '1',
00935                             'answers' => array(
00936                                 38 => (object) array(
00937                                     'id' => '38',
00938                                     'question' => '23',
00939                                     'answer' => '1. Wrong answer',
00940                                     'answerformat' => '1',
00941                                     'fraction' => '0.0000000',
00942                                     'feedback' => 'Feedback for this wrong answer',
00943                                     'feedbackformat' => '1',
00944                                 ),
00945                                 39 => (object) array(
00946                                     'id' => '39',
00947                                     'question' => '23',
00948                                     'answer' => '2. Another wrong  answer',
00949                                     'answerformat' => '1',
00950                                     'fraction' => '0.0000000',
00951                                     'feedback' => 'Feedback for the other wrong answer',
00952                                     'feedbackformat' => '1',
00953                                 ),
00954                                 40 => (object) array(
00955                                     'id' => '40',
00956                                     'question' => '23',
00957                                     'answer' => '3. Correct answer',
00958                                     'answerformat' => '1',
00959                                     'fraction' => '1.0000000',
00960                                     'feedback' => 'Feedback  for correct answer',
00961                                     'feedbackformat' => '1',
00962                                 ),
00963                                 41 => (object) array(
00964                                     'id' => '41',
00965                                     'question' => '23',
00966                                     'answer' => '4. Answer that gives half the credit',
00967                                     'answerformat' => '1',
00968                                     'fraction' => '0.5000000',
00969                                     'feedback' => 'Feedback for  half credit answer',
00970                                     'feedbackformat' => '1',
00971                                 ),
00972                             ),
00973                             'single' => '1',
00974                             'shuffleanswers' => '1',
00975                             'correctfeedback' => '',
00976                             'correctfeedbackformat' => '1',
00977                             'partiallycorrectfeedback' => '',
00978                             'partiallycorrectfeedbackformat' => '1',
00979                             'incorrectfeedback' => '',
00980                             'incorrectfeedbackformat' => '1',
00981                             'answernumbering' => '0',
00982                         ),
00983                         'maxgrade' => '2.0000000',
00984                     ),
00985                     5 => (object) array(
00986                         'id' => '24',
00987                         'category' => '2',
00988                         'parent' => '19',
00989                         'name' => 'Cloze',
00990                         'questiontext' => '{2:MCH:a. Wrong answer#Feedback for this wrong answer~b. Another wrong  answer#Feedback for the other wrong answer~=c. Correct answer#Feedback  for correct answer~%50%d. Answer that gives half the credit#Feedback for  half credit answer}',
00991                         'questiontextformat' => '0',
00992                         'generalfeedback' => '',
00993                         'generalfeedbackformat' => '1',
00994                         'defaultgrade' => '2.0000000',
00995                         'penalty' => '0.0000000',
00996                         'qtype' => 'multichoice',
00997                         'length' => '1',
00998                         'stamp' => 'tjh238.vledev2.open.ac.uk+110525164441+QGvRpd',
00999                         'version' => 'tjh238.vledev2.open.ac.uk+110525164441+03GsSs',
01000                         'hidden' => '0',
01001                         'timecreated' => '1306341881',
01002                         'timemodified' => '1306341881',
01003                         'createdby' => '2',
01004                         'modifiedby' => '2',
01005                         'options' => (object) array(
01006                             'id' => '5',
01007                             'question' => '24',
01008                             'layout' => '2',
01009                             'answers' => array(
01010                                 42 => (object) array(
01011                                     'id' => '42',
01012                                     'question' => '24',
01013                                     'answer' => 'a. Wrong answer',
01014                                     'answerformat' => '1',
01015                                     'fraction' => '0.0000000',
01016                                     'feedback' => 'Feedback for this wrong answer',
01017                                     'feedbackformat' => '1',
01018                                 ),
01019                                 43 => (object) array(
01020                                     'id' => '43',
01021                                     'question' => '24',
01022                                     'answer' => 'b. Another wrong  answer',
01023                                     'answerformat' => '1',
01024                                     'fraction' => '0.0000000',
01025                                     'feedback' => 'Feedback for the other wrong answer',
01026                                     'feedbackformat' => '1',
01027                                 ),
01028                                 44 => (object) array(
01029                                     'id' => '44',
01030                                     'question' => '24',
01031                                     'answer' => 'c. Correct answer',
01032                                     'answerformat' => '1',
01033                                     'fraction' => '1.0000000',
01034                                     'feedback' => 'Feedback  for correct answer',
01035                                     'feedbackformat' => '1',
01036                                 ),
01037                                 45 => (object) array(
01038                                     'id' => '45',
01039                                     'question' => '24',
01040                                     'answer' => 'd. Answer that gives half the credit',
01041                                     'answerformat' => '1',
01042                                     'fraction' => '0.5000000',
01043                                     'feedback' => 'Feedback for  half credit answer',
01044                                     'feedbackformat' => '1',
01045                                 ),
01046                             ),
01047                             'single' => '1',
01048                             'shuffleanswers' => '1',
01049                             'correctfeedback' => '',
01050                             'correctfeedbackformat' => '1',
01051                             'partiallycorrectfeedback' => '',
01052                             'partiallycorrectfeedbackformat' => '1',
01053                             'incorrectfeedback' => '',
01054                             'incorrectfeedbackformat' => '1',
01055                             'answernumbering' => '0',
01056                         ),
01057                         'maxgrade' => '2.0000000',
01058                     ),
01059                     6 => (object) array(
01060                         'id' => '25',
01061                         'category' => '2',
01062                         'parent' => '19',
01063                         'name' => 'Cloze',
01064                         'questiontext' => '{1:SHORTANSWER_C:moodle#Feedback for moodle in lower  case ~=MOODLE#Feedback for MOODLE in upper case ~%50%Moodle#Feedback for  only first letter in upper case}',
01065                         'questiontextformat' => '0',
01066                         'generalfeedback' => '',
01067                         'generalfeedbackformat' => '1',
01068                         'defaultgrade' => '1.0000000',
01069                         'penalty' => '0.0000000',
01070                         'qtype' => 'shortanswer',
01071                         'length' => '1',
01072                         'stamp' => 'tjh238.vledev2.open.ac.uk+110525164441+n9ETJC',
01073                         'version' => 'tjh238.vledev2.open.ac.uk+110525164441+Bvqo6c',
01074                         'hidden' => '0',
01075                         'timecreated' => '1306341881',
01076                         'timemodified' => '1306341881',
01077                         'createdby' => '2',
01078                         'modifiedby' => '2',
01079                         'options' => (object) array(
01080                             'answers' => array(
01081                                 46 => (object) array(
01082                                     'id' => '46',
01083                                     'question' => '25',
01084                                     'answer' => 'moodle',
01085                                     'answerformat' => '0',
01086                                     'fraction' => '0.0000000',
01087                                     'feedback' => 'Feedback for moodle in lower  case',
01088                                     'feedbackformat' => '1',
01089                                 ),
01090                                 47 => (object) array(
01091                                     'id' => '47',
01092                                     'question' => '25',
01093                                     'answer' => 'MOODLE',
01094                                     'answerformat' => '0',
01095                                     'fraction' => '1.0000000',
01096                                     'feedback' => 'Feedback for MOODLE in upper case',
01097                                     'feedbackformat' => '1',
01098                                 ),
01099                                 48 => (object) array(
01100                                     'id' => '48',
01101                                     'question' => '25',
01102                                     'answer' => 'Moodle',
01103                                     'answerformat' => '0',
01104                                     'fraction' => '0.5000000',
01105                                     'feedback' => 'Feedback for  only first letter in upper case',
01106                                     'feedbackformat' => '1',
01107                                 ),
01108                             ),
01109                             'usecase' => '1',
01110                         ),
01111                         'maxgrade' => '1.0000000',
01112                     ),
01113                     7 => (object) array(
01114                         'id' => '26',
01115                         'category' => '2',
01116                         'parent' => '19',
01117                         'name' => 'Cloze',
01118                         'questiontext' => '{:MULTICHOICE:=Yes#Correct~No#We have a different opinion}',
01119                         'questiontextformat' => '0',
01120                         'generalfeedback' => '',
01121                         'generalfeedbackformat' => '1',
01122                         'defaultgrade' => '1.0000000',
01123                         'penalty' => '0.0000000',
01124                         'qtype' => 'multichoice',
01125                         'length' => '1',
01126                         'stamp' => 'tjh238.vledev2.open.ac.uk+110525164441+0YjnZ7',
01127                         'version' => 'tjh238.vledev2.open.ac.uk+110525164441+1giLRX',
01128                         'hidden' => '0',
01129                         'timecreated' => '1306341881',
01130                         'timemodified' => '1306341881',
01131                         'createdby' => '2',
01132                         'modifiedby' => '2',
01133                         'options' => (object) array(
01134                             'id' => '6',
01135                             'question' => '26',
01136                             'layout' => '0',
01137                             'answers' => array(
01138                                 49 => (object) array(
01139                                     'id' => '49',
01140                                     'question' => '26',
01141                                     'answer' => 'Yes',
01142                                     'answerformat' => '1',
01143                                     'fraction' => '1.0000000',
01144                                     'feedback' => 'Correct',
01145                                     'feedbackformat' => '1',
01146                                 ),
01147                                 50 => (object) array(
01148                                     'id' => '50',
01149                                     'question' => '26',
01150                                     'answer' => 'No',
01151                                     'answerformat' => '1',
01152                                     'fraction' => '0.0000000',
01153                                     'feedback' => 'We have a different opinion',
01154                                     'feedbackformat' => '1',
01155                                 ),
01156                             ),
01157                             'single' => '1',
01158                             'shuffleanswers' => '1',
01159                             'correctfeedback' => '',
01160                             'correctfeedbackformat' => '1',
01161                             'partiallycorrectfeedback' => '',
01162                             'partiallycorrectfeedbackformat' => '1',
01163                             'incorrectfeedback' => '',
01164                             'incorrectfeedbackformat' => '1',
01165                             'answernumbering' => '0',
01166                         ),
01167                         'maxgrade' => '1.0000000',
01168                     ),
01169                     8 => (object) array(
01170                         'id' => '27',
01171                         'category' => '2',
01172                         'parent' => '19',
01173                         'name' => 'Cloze',
01174                         'questiontext' => '{3:NUMERICAL:=3:2}',
01175                         'questiontextformat' => '0',
01176                         'generalfeedback' => '',
01177                         'generalfeedbackformat' => '1',
01178                         'defaultgrade' => '3.0000000',
01179                         'penalty' => '0.0000000',
01180                         'qtype' => 'numerical',
01181                         'length' => '1',
01182                         'stamp' => 'tjh238.vledev2.open.ac.uk+110525164441+glbCBN',
01183                         'version' => 'tjh238.vledev2.open.ac.uk+110525164441+xWusxR',
01184                         'hidden' => '0',
01185                         'timecreated' => '1306341881',
01186                         'timemodified' => '1306341881',
01187                         'createdby' => '2',
01188                         'modifiedby' => '2',
01189                         'options' => (object) array(
01190                             'answers' => array(
01191                                 51 => (object) array(
01192                                     'id' => '51',
01193                                     'question' => '27',
01194                                     'answer' => '3',
01195                                     'answerformat' => '0',
01196                                     'fraction' => '1.0000000',
01197                                     'feedback' => '',
01198                                     'feedbackformat' => '1',
01199                                     'tolerance' => '2',
01200                                 ),
01201                             ),
01202                             'units' => array(
01203                             ),
01204                             'unitgradingtype' => '0',
01205                             'unitpenalty' => '1.0000000',
01206                             'showunits' => '3',
01207                             'unitsleft' => '0',
01208                             'instructions' => '',
01209                             'instructionsformat' => '1',
01210                         ),
01211                         'maxgrade' => '3.0000000',
01212                     ),
01213                 ),
01214             ),
01215             'defaultmark' => '13.0000000',
01216         );
01217         $qsession = (object) array(
01218             'id' => '105',
01219             'attemptid' => '16',
01220             'questionid' => '19',
01221             'newest' => '286',
01222             'newgraded' => '286',
01223             'sumpenalty' => '2.6000000',
01224             'manualcomment' => '',
01225             'manualcommentformat' => '1',
01226             'flagged' => '0',
01227         );
01228         $qstates = array(
01229             282 => (object) array(
01230                 'id' => '282',
01231                 'attempt' => '16',
01232                 'question' => '19',
01233                 'seq_number' => '0',
01234                 'answer' => '1-,2-,3-,4-,5-,6-,7-,8-',
01235                 'timestamp' => '1306425691',
01236                 'event' => '0',
01237                 'grade' => '0.0000000',
01238                 'raw_grade' => '0.0000000',
01239                 'penalty' => '0.0000000',
01240             ),
01241             284 => (object) array(
01242                 'id' => '284',
01243                 'attempt' => '16',
01244                 'question' => '19',
01245                 'seq_number' => '1',
01246                 'answer' => '1-31,2-dsf,3-sadf,4-39,5-44,6-MOODLE,7-49,8-100%',
01247                 'timestamp' => '1306425739',
01248                 'event' => '3',
01249                 'grade' => '5.0000000',
01250                 'raw_grade' => '5.0000000',
01251                 'penalty' => '1.3000000',
01252             ),
01253             286 => (object) array(
01254                 'id' => '286',
01255                 'attempt' => '16',
01256                 'question' => '19',
01257                 'seq_number' => '2',
01258                 'answer' => '1-31,2-dsf,3-sadf,4-39,5-44,6-MOODLE,7-49,8-100%',
01259                 'timestamp' => '1306425739',
01260                 'event' => '6',
01261                 'grade' => '5.0000000',
01262                 'raw_grade' => '5.0000000',
01263                 'penalty' => '1.3000000',
01264             ),
01265         );
01266 
01267         $qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates);
01268 
01269         $expectedqa = (object) array(
01270             'behaviour' => 'adaptivenopenalty',
01271             'questionid' => 19,
01272             'variant' => 1,
01273             'maxmark' => 13.0000000,
01274             'minfraction' => 0,
01275             'flagged' => 0,
01276             'questionsummary' => 'This question consists of some text with an answer embedded right here {Wrong answer; Another wrong answer; Correct answer; Answer that gives half the credit}
01277 
01278 and right after that you will have to deal with this short answer _____
01279 
01280 and finally we have a floating point number _____.
01281 
01282 The multichoice question can also be shown in the vertical display of the standard moodle multiple choice. {1. Wrong answer; 2. Another wrong answer; 3. Correct answer; 4. Answer that gives half the credit}
01283 
01284 Or in an horizontal display that is included here in a table {a. Wrong answer; b. Another wrong answer; c. Correct answer; d. Answer that gives half the credit}
01285 
01286 A shortanswer question where case must match. Write moodle in upper case letters _____
01287 
01288 Note that addresses like www.moodle.org and smileys :-) all work as normal:
01289 
01290 a) How good is this? {Yes; No}
01291 
01292 b) What grade would you give it? _____',
01293             'rightanswer' => 'part 1: Correct answer; part 2: Correct answer; part 3: 23.8; part 4: 3. Correct answer; part 5: c. Correct answer; part 6: MOODLE; part 7: Yes; part 8: 3',
01294             'responsesummary' => 'part 1: Correct answer; part 2: dsf; part 3: sadf; part 4: 2. Another wrong answer; part 5: c. Correct answer; part 6: MOODLE; part 7: Yes; part 8: 100%',
01295             'timemodified' => 1306425739,
01296             'steps' => array(
01297                 0 => (object) array(
01298                     'sequencenumber' => 0,
01299                     'state' => 'todo',
01300                     'fraction' => null,
01301                     'timecreated' => 1306425691,
01302                     'userid' => 4,
01303                     'data' => array('_sub1_order' => '29,30,31,32',
01304                             '_sub3_separators' => '.$,', '_sub4_order' => '38,39,40,41',
01305                             '_sub5_order' => '42,43,44,45', '_sub7_order' => '49,50',
01306                             '_sub8_separators' => '.$,'),
01307                 ),
01308                 1 => (object) array(
01309                     'sequencenumber' => 1,
01310                     'state' => 'todo',
01311                     'fraction' => 0.38461538461538466,
01312                     'timecreated' => 1306425739,
01313                     'userid' => 4,
01314                     'data' => array('sub1_answer' => '2', 'sub2_answer' => 'dsf',
01315                             'sub3_answer' => 'sadf', 'sub4_answer' => '1',
01316                             'sub5_answer' => '2', 'sub6_answer' => 'MOODLE',
01317                             'sub7_answer' => 'sadf', 'sub8_answer' => '100%', '-_try' => '1',
01318                             '-_rawfraction' => '0.38461538461538466', '-submit' => '1'),
01319                 ),
01320                 2 => (object) array(
01321                     'sequencenumber' => 2,
01322                     'state' => 'gradedpartial',
01323                     'fraction' => 0.38461538461538466,
01324                     'timecreated' => 1306425739,
01325                     'userid' => 4,
01326                     'data' => array('sub1_answer' => '2', 'sub2_answer' => 'dsf',
01327                             'sub3_answer' => 'sadf', 'sub4_answer' => '1',
01328                             'sub5_answer' => '2', 'sub6_answer' => 'MOODLE',
01329                             'sub7_answer' => 'sadf', 'sub8_answer' => '100%', '-_try' => '1',
01330                             '-_rawfraction' => '0.38461538461538466', '-finish' => '1'),
01331                 ),
01332             ),
01333         );
01334 
01335         $this->compare_qas($expectedqa, $qa);
01336     }
01337 
01338     public function test_multianswer_adaptivenopenalty_qsession107() {
01339         $quiz = (object) array(
01340             'id' => '5',
01341             'course' => '2',
01342             'name' => 'Multianswer quiz',
01343             'intro' => '',
01344             'introformat' => '1',
01345             'timeopen' => '0',
01346             'timeclose' => '0',
01347             'attempts' => '0',
01348             'attemptonlast' => '0',
01349             'grademethod' => '1',
01350             'decimalpoints' => '2',
01351             'questiondecimalpoints' => '-1',
01352             'review' => '4459503',
01353             'questionsperpage' => '1',
01354             'shufflequestions' => '0',
01355             'shuffleanswers' => '1',
01356             'questions' => '28,19,0',
01357             'sumgrades' => '14.00000',
01358             'grade' => '10.00000',
01359             'timecreated' => '0',
01360             'timemodified' => '1306424728',
01361             'timelimit' => '0',
01362             'password' => '',
01363             'subnet' => '',
01364             'popup' => '0',
01365             'delay1' => '0',
01366             'delay2' => '0',
01367             'showuserpicture' => '0',
01368             'showblocks' => '0',
01369             'preferredbehaviour' => 'adaptivenopenalty',
01370         );
01371         $attempt = (object) array(
01372             'id' => '17',
01373             'uniqueid' => '17',
01374             'quiz' => '5',
01375             'userid' => '4',
01376             'attempt' => '2',
01377             'sumgrades' => '0.00000',
01378             'timestart' => '1306425757',
01379             'timefinish' => '1306425762',
01380             'timemodified' => '1306425762',
01381             'layout' => '28,19,0',
01382             'preview' => '0',
01383             'needsupgradetonewqe' => 1,
01384         );
01385         $question = (object) array(
01386             'id' => '19',
01387             'category' => '2',
01388             'parent' => '0',
01389             'name' => 'Cloze',
01390             'questiontext' => '<p>This question consists of some text with an answer embedded right  here {#1}</p>
01391         <p>and right after that you will have to deal with this short answer  {#2}</p>
01392         <p>and finally we have a floating point number  {#3}.</p>
01393         <p>The  multichoice question can also be shown in the vertical  display of the standard moodle multiple choice. {#4}</p>
01394         <p>Or in an horizontal display that is included here in a table {#5}</p>
01395         <p>A shortanswer question where case must match. Write moodle in  upper case letters {#6}</p>
01396         <p>Note that addresses like www.moodle.org and smileys :-) all work as normal:</p>
01397         <p>a) How good is this? {#7}</p>
01398         <p>b) What grade would you give it? {#8}</p>',
01399             'questiontextformat' => '1',
01400             'generalfeedback' => '',
01401             'generalfeedbackformat' => '1',
01402             'penalty' => '0.1000000',
01403             'qtype' => 'multianswer',
01404             'length' => '1',
01405             'stamp' => 'tjh238.vledev2.open.ac.uk+110525164438+iwiint',
01406             'version' => 'tjh238.vledev2.open.ac.uk+110525164441+AAjnIy',
01407             'hidden' => '0',
01408             'timecreated' => '1306341878',
01409             'timemodified' => '1306341879',
01410             'createdby' => '2',
01411             'modifiedby' => '2',
01412             'maxmark' => '13.0000000',
01413             'options' => (object) array(
01414                 'questions' => array(
01415                     1 => (object) array(
01416                         'id' => '20',
01417                         'category' => '2',
01418                         'parent' => '19',
01419                         'name' => 'Cloze',
01420                         'questiontext' => '{1:MULTICHOICE:Wrong answer#Feedback for this wrong answer~Another  wrong answer#Feedback for the other wrong answer~=Correct  answer#Feedback for correct answer~%50%Answer that gives half the  credit#Feedback for half credit answer}',
01421                         'questiontextformat' => '0',
01422                         'generalfeedback' => '',
01423                         'generalfeedbackformat' => '1',
01424                         'defaultgrade' => '1.0000000',
01425                         'penalty' => '0.0000000',
01426                         'qtype' => 'multichoice',
01427                         'length' => '1',
01428                         'stamp' => 'tjh238.vledev2.open.ac.uk+110525164439+cAuJ4r',
01429                         'version' => 'tjh238.vledev2.open.ac.uk+110525164439+5bnnys',
01430                         'hidden' => '0',
01431                         'timecreated' => '1306341879',
01432                         'timemodified' => '1306341879',
01433                         'createdby' => '2',
01434                         'modifiedby' => '2',
01435                         'options' => (object) array(
01436                             'id' => '3',
01437                             'question' => '20',
01438                             'layout' => '0',
01439                             'answers' => array(
01440                                 29 => (object) array(
01441                                     'id' => '29',
01442                                     'question' => '20',
01443                                     'answer' => 'Wrong answer',
01444                                     'answerformat' => '1',
01445                                     'fraction' => '0.0000000',
01446                                     'feedback' => 'Feedback for this wrong answer',
01447                                     'feedbackformat' => '1',
01448                                 ),
01449                                 30 => (object) array(
01450                                     'id' => '30',
01451                                     'question' => '20',
01452                                     'answer' => 'Another  wrong answer',
01453                                     'answerformat' => '1',
01454                                     'fraction' => '0.0000000',
01455                                     'feedback' => 'Feedback for the other wrong answer',
01456                                     'feedbackformat' => '1',
01457                                 ),
01458                                 31 => (object) array(
01459                                     'id' => '31',
01460                                     'question' => '20',
01461                                     'answer' => 'Correct  answer',
01462                                     'answerformat' => '1',
01463                                     'fraction' => '1.0000000',
01464                                     'feedback' => 'Feedback for correct answer',
01465                                     'feedbackformat' => '1',
01466                                 ),
01467                                 32 => (object) array(
01468                                     'id' => '32',
01469                                     'question' => '20',
01470                                     'answer' => 'Answer that gives half the  credit',
01471                                     'answerformat' => '1',
01472                                     'fraction' => '0.5000000',
01473                                     'feedback' => 'Feedback for half credit answer',
01474                                     'feedbackformat' => '1',
01475                                 ),
01476                             ),
01477                             'single' => '1',
01478                             'shuffleanswers' => '1',
01479                             'correctfeedback' => '',
01480                             'correctfeedbackformat' => '1',
01481                             'partiallycorrectfeedback' => '',
01482                             'partiallycorrectfeedbackformat' => '1',
01483                             'incorrectfeedback' => '',
01484                             'incorrectfeedbackformat' => '1',
01485                             'answernumbering' => '0',
01486                         ),
01487                         'maxgrade' => '1.0000000',
01488                     ),
01489                     2 => (object) array(
01490                         'id' => '21',
01491                         'category' => '2',
01492                         'parent' => '19',
01493                         'name' => 'Cloze',
01494                         'questiontext' => '{1:SHORTANSWER:Wrong answer#Feedback for this wrong answer~=Correct  answer#Feedback for correct answer~%50%Answer that gives half the  credit#Feedback for half credit answer}',
01495                         'questiontextformat' => '0',
01496                         'generalfeedback' => '',
01497                         'generalfeedbackformat' => '1',
01498                         'defaultgrade' => '1.0000000',
01499                         'penalty' => '0.0000000',
01500                         'qtype' => 'shortanswer',
01501                         'length' => '1',
01502                         'stamp' => 'tjh238.vledev2.open.ac.uk+110525164440+EN6wCk',
01503                         'version' => 'tjh238.vledev2.open.ac.uk+110525164440+bQzatI',
01504                         'hidden' => '0',
01505                         'timecreated' => '1306341880',
01506                         'timemodified' => '1306341880',
01507                         'createdby' => '2',
01508                         'modifiedby' => '2',
01509                         'options' => (object) array(
01510                             'answers' => array(
01511                                 33 => (object) array(
01512                                     'id' => '33',
01513                                     'question' => '21',
01514                                     'answer' => 'Wrong answer',
01515                                     'answerformat' => '0',
01516                                     'fraction' => '0.0000000',
01517                                     'feedback' => 'Feedback for this wrong answer',
01518                                     'feedbackformat' => '1',
01519                                 ),
01520                                 34 => (object) array(
01521                                     'id' => '34',
01522                                     'question' => '21',
01523                                     'answer' => 'Correct  answer',
01524                                     'answerformat' => '0',
01525                                     'fraction' => '1.0000000',
01526                                     'feedback' => 'Feedback for correct answer',
01527                                     'feedbackformat' => '1',
01528                                 ),
01529                                 35 => (object) array(
01530                                     'id' => '35',
01531                                     'question' => '21',
01532                                     'answer' => 'Answer that gives half the  credit',
01533                                     'answerformat' => '0',
01534                                     'fraction' => '0.5000000',
01535                                     'feedback' => 'Feedback for half credit answer',
01536                                     'feedbackformat' => '1',
01537                                 ),
01538                             ),
01539                             'usecase' => '0',
01540                         ),
01541                         'maxgrade' => '1.0000000',
01542                     ),
01543                     3 => (object) array(
01544                         'id' => '22',
01545                         'category' => '2',
01546                         'parent' => '19',
01547                         'name' => 'Cloze',
01548                         'questiontext' => '{2:NUMERICAL:=23.8:0.1#Feedback for correct answer  23.8~%50%23.8:2#Feedback for half credit answer in the nearby region of  the correct answer}',
01549                         'questiontextformat' => '0',
01550                         'generalfeedback' => '',
01551                         'generalfeedbackformat' => '1',
01552                         'defaultgrade' => '2.0000000',
01553                         'penalty' => '0.0000000',
01554                         'qtype' => 'numerical',
01555                         'length' => '1',
01556                         'stamp' => 'tjh238.vledev2.open.ac.uk+110525164440+Xr29c2',
01557                         'version' => 'tjh238.vledev2.open.ac.uk+110525164441+QTwsGM',
01558                         'hidden' => '0',
01559                         'timecreated' => '1306341880',
01560                         'timemodified' => '1306341880',
01561                         'createdby' => '2',
01562                         'modifiedby' => '2',
01563                         'options' => (object) array(
01564                             'answers' => array(
01565                                 36 => (object) array(
01566                                     'id' => '36',
01567                                     'question' => '22',
01568                                     'answer' => '23.8',
01569                                     'answerformat' => '0',
01570                                     'fraction' => '1.0000000',
01571                                     'feedback' => 'Feedback for correct answer  23.8',
01572                                     'feedbackformat' => '1',
01573                                     'tolerance' => '0.1',
01574                                 ),
01575                                 37 => (object) array(
01576                                     'id' => '37',
01577                                     'question' => '22',
01578                                     'answer' => '23.8',
01579                                     'answerformat' => '0',
01580                                     'fraction' => '0.5000000',
01581                                     'feedback' => 'Feedback for half credit answer in the nearby region of  the correct answer',
01582                                     'feedbackformat' => '1',
01583                                     'tolerance' => '2',
01584                                 ),
01585                             ),
01586                             'units' => array(
01587                             ),
01588                             'unitgradingtype' => '0',
01589                             'unitpenalty' => '1.0000000',
01590                             'showunits' => '3',
01591                             'unitsleft' => '0',
01592                             'instructions' => '',
01593                             'instructionsformat' => '1',
01594                         ),
01595                         'maxgrade' => '2.0000000',
01596                     ),
01597                     4 => (object) array(
01598                         'id' => '23',
01599                         'category' => '2',
01600                         'parent' => '19',
01601                         'name' => 'Cloze',
01602                         'questiontext' => '{2:MCV:1. Wrong answer#Feedback for this wrong answer~2. Another wrong  answer#Feedback for the other wrong answer~=3. Correct answer#Feedback  for correct answer~%50%4. Answer that gives half the credit#Feedback for  half credit answer}',
01603                         'questiontextformat' => '0',
01604                         'generalfeedback' => '',
01605                         'generalfeedbackformat' => '1',
01606                         'defaultgrade' => '2.0000000',
01607                         'penalty' => '0.0000000',
01608                         'qtype' => 'multichoice',
01609                         'length' => '1',
01610                         'stamp' => 'tjh238.vledev2.open.ac.uk+110525164441+7R55HA',
01611                         'version' => 'tjh238.vledev2.open.ac.uk+110525164441+uCMoQc',
01612                         'hidden' => '0',
01613                         'timecreated' => '1306341881',
01614                         'timemodified' => '1306341881',
01615                         'createdby' => '2',
01616                         'modifiedby' => '2',
01617                         'options' => (object) array(
01618                             'id' => '4',
01619                             'question' => '23',
01620                             'layout' => '1',
01621                             'answers' => array(
01622                                 38 => (object) array(
01623                                     'id' => '38',
01624                                     'question' => '23',
01625                                     'answer' => '1. Wrong answer',
01626                                     'answerformat' => '1',
01627                                     'fraction' => '0.0000000',
01628                                     'feedback' => 'Feedback for this wrong answer',
01629                                     'feedbackformat' => '1',
01630                                 ),
01631                                 39 => (object) array(
01632                                     'id' => '39',
01633                                     'question' => '23',
01634                                     'answer' => '2. Another wrong  answer',
01635                                     'answerformat' => '1',
01636                                     'fraction' => '0.0000000',
01637                                     'feedback' => 'Feedback for the other wrong answer',
01638                                     'feedbackformat' => '1',
01639                                 ),
01640                                 40 => (object) array(
01641                                     'id' => '40',
01642                                     'question' => '23',
01643                                     'answer' => '3. Correct answer',
01644                                     'answerformat' => '1',
01645                                     'fraction' => '1.0000000',
01646                                     'feedback' => 'Feedback  for correct answer',
01647                                     'feedbackformat' => '1',
01648                                 ),
01649                                 41 => (object) array(
01650                                     'id' => '41',
01651                                     'question' => '23',
01652                                     'answer' => '4. Answer that gives half the credit',
01653                                     'answerformat' => '1',
01654                                     'fraction' => '0.5000000',
01655                                     'feedback' => 'Feedback for  half credit answer',
01656                                     'feedbackformat' => '1',
01657                                 ),
01658                             ),
01659                             'single' => '1',
01660                             'shuffleanswers' => '1',
01661                             'correctfeedback' => '',
01662                             'correctfeedbackformat' => '1',
01663                             'partiallycorrectfeedback' => '',
01664                             'partiallycorrectfeedbackformat' => '1',
01665                             'incorrectfeedback' => '',
01666                             'incorrectfeedbackformat' => '1',
01667                             'answernumbering' => '0',
01668                         ),
01669                         'maxgrade' => '2.0000000',
01670                     ),
01671                     5 => (object) array(
01672                         'id' => '24',
01673                         'category' => '2',
01674                         'parent' => '19',
01675                         'name' => 'Cloze',
01676                         'questiontext' => '{2:MCH:a. Wrong answer#Feedback for this wrong answer~b. Another wrong  answer#Feedback for the other wrong answer~=c. Correct answer#Feedback  for correct answer~%50%d. Answer that gives half the credit#Feedback for  half credit answer}',
01677                         'questiontextformat' => '0',
01678                         'generalfeedback' => '',
01679                         'generalfeedbackformat' => '1',
01680                         'defaultgrade' => '2.0000000',
01681                         'penalty' => '0.0000000',
01682                         'qtype' => 'multichoice',
01683                         'length' => '1',
01684                         'stamp' => 'tjh238.vledev2.open.ac.uk+110525164441+QGvRpd',
01685                         'version' => 'tjh238.vledev2.open.ac.uk+110525164441+03GsSs',
01686                         'hidden' => '0',
01687                         'timecreated' => '1306341881',
01688                         'timemodified' => '1306341881',
01689                         'createdby' => '2',
01690                         'modifiedby' => '2',
01691                         'options' => (object) array(
01692                             'id' => '5',
01693                             'question' => '24',
01694                             'layout' => '2',
01695                             'answers' => array(
01696                                 42 => (object) array(
01697                                     'id' => '42',
01698                                     'question' => '24',
01699                                     'answer' => 'a. Wrong answer',
01700                                     'answerformat' => '1',
01701                                     'fraction' => '0.0000000',
01702                                     'feedback' => 'Feedback for this wrong answer',
01703                                     'feedbackformat' => '1',
01704                                 ),
01705                                 43 => (object) array(
01706                                     'id' => '43',
01707                                     'question' => '24',
01708                                     'answer' => 'b. Another wrong  answer',
01709                                     'answerformat' => '1',
01710                                     'fraction' => '0.0000000',
01711                                     'feedback' => 'Feedback for the other wrong answer',
01712                                     'feedbackformat' => '1',
01713                                 ),
01714                                 44 => (object) array(
01715                                     'id' => '44',
01716                                     'question' => '24',
01717                                     'answer' => 'c. Correct answer',
01718                                     'answerformat' => '1',
01719                                     'fraction' => '1.0000000',
01720                                     'feedback' => 'Feedback  for correct answer',
01721                                     'feedbackformat' => '1',
01722                                 ),
01723                                 45 => (object) array(
01724                                     'id' => '45',
01725                                     'question' => '24',
01726                                     'answer' => 'd. Answer that gives half the credit',
01727                                     'answerformat' => '1',
01728                                     'fraction' => '0.5000000',
01729                                     'feedback' => 'Feedback for  half credit answer',
01730                                     'feedbackformat' => '1',
01731                                 ),
01732                             ),
01733                             'single' => '1',
01734                             'shuffleanswers' => '1',
01735                             'correctfeedback' => '',
01736                             'correctfeedbackformat' => '1',
01737                             'partiallycorrectfeedback' => '',
01738                             'partiallycorrectfeedbackformat' => '1',
01739                             'incorrectfeedback' => '',
01740                             'incorrectfeedbackformat' => '1',
01741                             'answernumbering' => '0',
01742                         ),
01743                         'maxgrade' => '2.0000000',
01744                     ),
01745                     6 => (object) array(
01746                         'id' => '25',
01747                         'category' => '2',
01748                         'parent' => '19',
01749                         'name' => 'Cloze',
01750                         'questiontext' => '{1:SHORTANSWER_C:moodle#Feedback for moodle in lower  case ~=MOODLE#Feedback for MOODLE in upper case ~%50%Moodle#Feedback for  only first letter in upper case}',
01751                         'questiontextformat' => '0',
01752                         'generalfeedback' => '',
01753                         'generalfeedbackformat' => '1',
01754                         'defaultgrade' => '1.0000000',
01755                         'penalty' => '0.0000000',
01756                         'qtype' => 'shortanswer',
01757                         'length' => '1',
01758                         'stamp' => 'tjh238.vledev2.open.ac.uk+110525164441+n9ETJC',
01759                         'version' => 'tjh238.vledev2.open.ac.uk+110525164441+Bvqo6c',
01760                         'hidden' => '0',
01761                         'timecreated' => '1306341881',
01762                         'timemodified' => '1306341881',
01763                         'createdby' => '2',
01764                         'modifiedby' => '2',
01765                         'options' => (object) array(
01766                             'answers' => array(
01767                                 46 => (object) array(
01768                                     'id' => '46',
01769                                     'question' => '25',
01770                                     'answer' => 'moodle',
01771                                     'answerformat' => '0',
01772                                     'fraction' => '0.0000000',
01773                                     'feedback' => 'Feedback for moodle in lower  case',
01774                                     'feedbackformat' => '1',
01775                                 ),
01776                                 47 => (object) array(
01777                                     'id' => '47',
01778                                     'question' => '25',
01779                                     'answer' => 'MOODLE',
01780                                     'answerformat' => '0',
01781                                     'fraction' => '1.0000000',
01782                                     'feedback' => 'Feedback for MOODLE in upper case',
01783                                     'feedbackformat' => '1',
01784                                 ),
01785                                 48 => (object) array(
01786                                     'id' => '48',
01787                                     'question' => '25',
01788                                     'answer' => 'Moodle',
01789                                     'answerformat' => '0',
01790                                     'fraction' => '0.5000000',
01791                                     'feedback' => 'Feedback for  only first letter in upper case',
01792                                     'feedbackformat' => '1',
01793                                 ),
01794                             ),
01795                             'usecase' => '1',
01796                         ),
01797                         'maxgrade' => '1.0000000',
01798                     ),
01799                     7 => (object) array(
01800                         'id' => '26',
01801                         'category' => '2',
01802                         'parent' => '19',
01803                         'name' => 'Cloze',
01804                         'questiontext' => '{:MULTICHOICE:=Yes#Correct~No#We have a different opinion}',
01805                         'questiontextformat' => '0',
01806                         'generalfeedback' => '',
01807                         'generalfeedbackformat' => '1',
01808                         'defaultgrade' => '1.0000000',
01809                         'penalty' => '0.0000000',
01810                         'qtype' => 'multichoice',
01811                         'length' => '1',
01812                         'stamp' => 'tjh238.vledev2.open.ac.uk+110525164441+0YjnZ7',
01813                         'version' => 'tjh238.vledev2.open.ac.uk+110525164441+1giLRX',
01814                         'hidden' => '0',
01815                         'timecreated' => '1306341881',
01816                         'timemodified' => '1306341881',
01817                         'createdby' => '2',
01818                         'modifiedby' => '2',
01819                         'options' => (object) array(
01820                             'id' => '6',
01821                             'question' => '26',
01822                             'layout' => '0',
01823                             'answers' => array(
01824                                 49 => (object) array(
01825                                     'id' => '49',
01826                                     'question' => '26',
01827                                     'answer' => 'Yes',
01828                                     'answerformat' => '1',
01829                                     'fraction' => '1.0000000',
01830                                     'feedback' => 'Correct',
01831                                     'feedbackformat' => '1',
01832                                 ),
01833                                 50 => (object) array(
01834                                     'id' => '50',
01835                                     'question' => '26',
01836                                     'answer' => 'No',
01837                                     'answerformat' => '1',
01838                                     'fraction' => '0.0000000',
01839                                     'feedback' => 'We have a different opinion',
01840                                     'feedbackformat' => '1',
01841                                 ),
01842                             ),
01843                             'single' => '1',
01844                             'shuffleanswers' => '1',
01845                             'correctfeedback' => '',
01846                             'correctfeedbackformat' => '1',
01847                             'partiallycorrectfeedback' => '',
01848                             'partiallycorrectfeedbackformat' => '1',
01849                             'incorrectfeedback' => '',
01850                             'incorrectfeedbackformat' => '1',
01851                             'answernumbering' => '0',
01852                         ),
01853                         'maxgrade' => '1.0000000',
01854                     ),
01855                     8 => (object) array(
01856                         'id' => '27',
01857                         'category' => '2',
01858                         'parent' => '19',
01859                         'name' => 'Cloze',
01860                         'questiontext' => '{3:NUMERICAL:=3:2}',
01861                         'questiontextformat' => '0',
01862                         'generalfeedback' => '',
01863                         'generalfeedbackformat' => '1',
01864                         'defaultgrade' => '3.0000000',
01865                         'penalty' => '0.0000000',
01866                         'qtype' => 'numerical',
01867                         'length' => '1',
01868                         'stamp' => 'tjh238.vledev2.open.ac.uk+110525164441+glbCBN',
01869                         'version' => 'tjh238.vledev2.open.ac.uk+110525164441+xWusxR',
01870                         'hidden' => '0',
01871                         'timecreated' => '1306341881',
01872                         'timemodified' => '1306341881',
01873                         'createdby' => '2',
01874                         'modifiedby' => '2',
01875                         'options' => (object) array(
01876                             'answers' => array(
01877                                 51 => (object) array(
01878                                     'id' => '51',
01879                                     'question' => '27',
01880                                     'answer' => '3',
01881                                     'answerformat' => '0',
01882                                     'fraction' => '1.0000000',
01883                                     'feedback' => '',
01884                                     'feedbackformat' => '1',
01885                                     'tolerance' => '2',
01886                                 ),
01887                             ),
01888                             'units' => array(
01889                             ),
01890                             'unitgradingtype' => '0',
01891                             'unitpenalty' => '1.0000000',
01892                             'showunits' => '3',
01893                             'unitsleft' => '0',
01894                             'instructions' => '',
01895                             'instructionsformat' => '1',
01896                         ),
01897                         'maxgrade' => '3.0000000',
01898                     ),
01899                 ),
01900             ),
01901             'defaultmark' => '13.0000000',
01902         );
01903         $qsession = (object) array(
01904             'id' => '107',
01905             'attemptid' => '17',
01906             'questionid' => '19',
01907             'newest' => '290',
01908             'newgraded' => '290',
01909             'sumpenalty' => '1.3000000',
01910             'manualcomment' => '',
01911             'manualcommentformat' => '1',
01912             'flagged' => '0',
01913         );
01914         $qstates = array(
01915             288 => (object) array(
01916                 'id' => '288',
01917                 'attempt' => '17',
01918                 'question' => '19',
01919                 'seq_number' => '0',
01920                 'answer' => '1-,2-,3-,4-,5-,6-,7-,8-',
01921                 'timestamp' => '1306425757',
01922                 'event' => '0',
01923                 'grade' => '0.0000000',
01924                 'raw_grade' => '0.0000000',
01925                 'penalty' => '0.0000000',
01926             ),
01927             290 => (object) array(
01928                 'id' => '290',
01929                 'attempt' => '17',
01930                 'question' => '19',
01931                 'seq_number' => '1',
01932                 'answer' => '1-,2-,3-,4-,5-,6-,7-,8-',
01933                 'timestamp' => '1306425757',
01934                 'event' => '6',
01935                 'grade' => '0.0000000',
01936                 'raw_grade' => '0.0000000',
01937                 'penalty' => '1.3000000',
01938             ),
01939         );
01940 
01941         $qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates);
01942 
01943         $expectedqa = (object) array(
01944             'behaviour' => 'adaptivenopenalty',
01945             'questionid' => 19,
01946             'variant' => 1,
01947             'maxmark' => 13.0000000,
01948             'minfraction' => 0,
01949             'flagged' => 0,
01950             'questionsummary' => 'This question consists of some text with an answer embedded right here {Wrong answer; Another wrong answer; Correct answer; Answer that gives half the credit}
01951 
01952 and right after that you will have to deal with this short answer _____
01953 
01954 and finally we have a floating point number _____.
01955 
01956 The multichoice question can also be shown in the vertical display of the standard moodle multiple choice. {1. Wrong answer; 2. Another wrong answer; 3. Correct answer; 4. Answer that gives half the credit}
01957 
01958 Or in an horizontal display that is included here in a table {a. Wrong answer; b. Another wrong answer; c. Correct answer; d. Answer that gives half the credit}
01959 
01960 A shortanswer question where case must match. Write moodle in upper case letters _____
01961 
01962 Note that addresses like www.moodle.org and smileys :-) all work as normal:
01963 
01964 a) How good is this? {Yes; No}
01965 
01966 b) What grade would you give it? _____',
01967             'rightanswer' => 'part 1: Correct answer; part 2: Correct answer; part 3: 23.8; part 4: 3. Correct answer; part 5: c. Correct answer; part 6: MOODLE; part 7: Yes; part 8: 3',
01968             'responsesummary' => 'part 1: ; part 2: ; part 3: ; part 4: ; part 5: ; part 6: ; part 7: ; part 8: ',
01969             'timemodified' => 1306425757,
01970             'steps' => array(
01971                 0 => (object) array(
01972                     'sequencenumber' => 0,
01973                     'state' => 'todo',
01974                     'fraction' => null,
01975                     'timecreated' => 1306425757,
01976                     'userid' => 4,
01977                     'data' => array('_sub1_order' => '29,30,31,32',
01978                             '_sub3_separators' => '.$,', '_sub4_order' => '38,39,40,41',
01979                             '_sub5_order' => '42,43,44,45', '_sub7_order' => '49,50',
01980                             '_sub8_separators' => '.$,'),
01981                 ),
01982                 1 => (object) array(
01983                     'sequencenumber' => 1,
01984                     'state' => 'gradedwrong',
01985                     'fraction' => 0.0,
01986                     'timecreated' => 1306425757,
01987                     'userid' => 4,
01988                     'data' => array('-finish' => '1', '-_try' => '1', '-_rawfraction' => 0.0),
01989                 ),
01990             ),
01991         );
01992 
01993         $this->compare_qas($expectedqa, $qa);
01994     }
01995 
01996     public function test_multianswer_adaptivenopenalty_qsession109() {
01997         $quiz = (object) array(
01998             'id' => '5',
01999             'course' => '2',
02000             'name' => 'Multianswer quiz',
02001             'intro' => '',
02002             'introformat' => '1',
02003             'timeopen' => '0',
02004             'timeclose' => '0',
02005             'attempts' => '0',
02006             'attemptonlast' => '0',
02007             'grademethod' => '1',
02008             'decimalpoints' => '2',
02009             'questiondecimalpoints' => '-1',
02010             'review' => '4459503',
02011             'questionsperpage' => '1',
02012             'shufflequestions' => '0',
02013             'shuffleanswers' => '1',
02014             'questions' => '28,19,0',
02015             'sumgrades' => '14.00000',
02016             'grade' => '10.00000',
02017             'timecreated' => '0',
02018             'timemodified' => '1306424728',
02019             'timelimit' => '0',
02020             'password' => '',
02021             'subnet' => '',
02022             'popup' => '0',
02023             'delay1' => '0',
02024             'delay2' => '0',
02025             'showuserpicture' => '0',
02026             'showblocks' => '0',
02027             'preferredbehaviour' => 'adaptivenopenalty',
02028         );
02029         $attempt = (object) array(
02030             'id' => '18',
02031             'uniqueid' => '18',
02032             'quiz' => '5',
02033             'userid' => '3',
02034             'attempt' => '1',
02035             'sumgrades' => '10.40000',
02036             'timestart' => '1306425784',
02037             'timefinish' => '1306425931',
02038             'timemodified' => '1306425931',
02039             'layout' => '28,19,0',
02040             'preview' => '0',
02041             'needsupgradetonewqe' => 1,
02042         );
02043         $question = (object) array(
02044             'id' => '19',
02045             'category' => '2',
02046             'parent' => '0',
02047             'name' => 'Cloze',
02048             'questiontext' => '<p>This question consists of some text with an answer embedded right  here {#1}</p>
02049         <p>and right after that you will have to deal with this short answer  {#2}</p>
02050         <p>and finally we have a floating point number  {#3}.</p>
02051         <p>The  multichoice question can also be shown in the vertical  display of the standard moodle multiple choice. {#4}</p>
02052         <p>Or in an horizontal display that is included here in a table {#5}</p>
02053         <p>A shortanswer question where case must match. Write moodle in  upper case letters {#6}</p>
02054         <p>Note that addresses like www.moodle.org and smileys :-) all work as normal:</p>
02055         <p>a) How good is this? {#7}</p>
02056         <p>b) What grade would you give it? {#8}</p>',
02057             'questiontextformat' => '1',
02058             'generalfeedback' => '',
02059             'generalfeedbackformat' => '1',
02060             'penalty' => '0.1000000',
02061             'qtype' => 'multianswer',
02062             'length' => '1',
02063             'stamp' => 'tjh238.vledev2.open.ac.uk+110525164438+iwiint',
02064             'version' => 'tjh238.vledev2.open.ac.uk+110525164441+AAjnIy',
02065             'hidden' => '0',
02066             'timecreated' => '1306341878',
02067             'timemodified' => '1306341879',
02068             'createdby' => '2',
02069             'modifiedby' => '2',
02070             'maxmark' => '13.0000000',
02071             'options' => (object) array(
02072                 'questions' => array(
02073                     1 => (object) array(
02074                         'id' => '20',
02075                         'category' => '2',
02076                         'parent' => '19',
02077                         'name' => 'Cloze',
02078                         'questiontext' => '{1:MULTICHOICE:Wrong answer#Feedback for this wrong answer~Another  wrong answer#Feedback for the other wrong answer~=Correct  answer#Feedback for correct answer~%50%Answer that gives half the  credit#Feedback for half credit answer}',
02079                         'questiontextformat' => '0',
02080                         'generalfeedback' => '',
02081                         'generalfeedbackformat' => '1',
02082                         'defaultgrade' => '1.0000000',
02083                         'penalty' => '0.0000000',
02084                         'qtype' => 'multichoice',
02085                         'length' => '1',
02086                         'stamp' => 'tjh238.vledev2.open.ac.uk+110525164439+cAuJ4r',
02087                         'version' => 'tjh238.vledev2.open.ac.uk+110525164439+5bnnys',
02088                         'hidden' => '0',
02089                         'timecreated' => '1306341879',
02090                         'timemodified' => '1306341879',
02091                         'createdby' => '2',
02092                         'modifiedby' => '2',
02093                         'options' => (object) array(
02094                             'id' => '3',
02095                             'question' => '20',
02096                             'layout' => '0',
02097                             'answers' => array(
02098                                 29 => (object) array(
02099                                     'id' => '29',
02100                                     'question' => '20',
02101                                     'answer' => 'Wrong answer',
02102                                     'answerformat' => '1',
02103                                     'fraction' => '0.0000000',
02104                                     'feedback' => 'Feedback for this wrong answer',
02105                                     'feedbackformat' => '1',
02106                                 ),
02107                                 30 => (object) array(
02108                                     'id' => '30',
02109                                     'question' => '20',
02110                                     'answer' => 'Another  wrong answer',
02111                                     'answerformat' => '1',
02112                                     'fraction' => '0.0000000',
02113                                     'feedback' => 'Feedback for the other wrong answer',
02114                                     'feedbackformat' => '1',
02115                                 ),
02116                                 31 => (object) array(
02117                                     'id' => '31',
02118                                     'question' => '20',
02119                                     'answer' => 'Correct  answer',
02120                                     'answerformat' => '1',
02121                                     'fraction' => '1.0000000',
02122                                     'feedback' => 'Feedback for correct answer',
02123                                     'feedbackformat' => '1',
02124                                 ),
02125                                 32 => (object) array(
02126                                     'id' => '32',
02127                                     'question' => '20',
02128                                     'answer' => 'Answer that gives half the  credit',
02129                                     'answerformat' => '1',
02130                                     'fraction' => '0.5000000',
02131                                     'feedback' => 'Feedback for half credit answer',
02132                                     'feedbackformat' => '1',
02133                                 ),
02134                             ),
02135                             'single' => '1',
02136                             'shuffleanswers' => '1',
02137                             'correctfeedback' => '',
02138                             'correctfeedbackformat' => '1',
02139                             'partiallycorrectfeedback' => '',
02140                             'partiallycorrectfeedbackformat' => '1',
02141                             'incorrectfeedback' => '',
02142                             'incorrectfeedbackformat' => '1',
02143                             'answernumbering' => '0',
02144                         ),
02145                         'maxgrade' => '1.0000000',
02146                     ),
02147                     2 => (object) array(
02148                         'id' => '21',
02149                         'category' => '2',
02150                         'parent' => '19',
02151                         'name' => 'Cloze',
02152                         'questiontext' => '{1:SHORTANSWER:Wrong answer#Feedback for this wrong answer~=Correct  answer#Feedback for correct answer~%50%Answer that gives half the  credit#Feedback for half credit answer}',
02153                         'questiontextformat' => '0',
02154                         'generalfeedback' => '',
02155                         'generalfeedbackformat' => '1',
02156                         'defaultgrade' => '1.0000000',
02157                         'penalty' => '0.0000000',
02158                         'qtype' => 'shortanswer',
02159                         'length' => '1',
02160                         'stamp' => 'tjh238.vledev2.open.ac.uk+110525164440+EN6wCk',
02161                         'version' => 'tjh238.vledev2.open.ac.uk+110525164440+bQzatI',
02162                         'hidden' => '0',
02163                         'timecreated' => '1306341880',
02164                         'timemodified' => '1306341880',
02165                         'createdby' => '2',
02166                         'modifiedby' => '2',
02167                         'options' => (object) array(
02168                             'answers' => array(
02169                                 33 => (object) array(
02170                                     'id' => '33',
02171                                     'question' => '21',
02172                                     'answer' => 'Wrong answer',
02173                                     'answerformat' => '0',
02174                                     'fraction' => '0.0000000',
02175                                     'feedback' => 'Feedback for this wrong answer',
02176                                     'feedbackformat' => '1',
02177                                 ),
02178                                 34 => (object) array(
02179                                     'id' => '34',
02180                                     'question' => '21',
02181                                     'answer' => 'Correct  answer',
02182                                     'answerformat' => '0',
02183                                     'fraction' => '1.0000000',
02184                                     'feedback' => 'Feedback for correct answer',
02185                                     'feedbackformat' => '1',
02186                                 ),
02187                                 35 => (object) array(
02188                                     'id' => '35',
02189                                     'question' => '21',
02190                                     'answer' => 'Answer that gives half the  credit',
02191                                     'answerformat' => '0',
02192                                     'fraction' => '0.5000000',
02193                                     'feedback' => 'Feedback for half credit answer',
02194                                     'feedbackformat' => '1',
02195                                 ),
02196                             ),
02197                             'usecase' => '0',
02198                         ),
02199                         'maxgrade' => '1.0000000',
02200                     ),
02201                     3 => (object) array(
02202                         'id' => '22',
02203                         'category' => '2',
02204                         'parent' => '19',
02205                         'name' => 'Cloze',
02206                         'questiontext' => '{2:NUMERICAL:=23.8:0.1#Feedback for correct answer  23.8~%50%23.8:2#Feedback for half credit answer in the nearby region of  the correct answer}',
02207                         'questiontextformat' => '0',
02208                         'generalfeedback' => '',
02209                         'generalfeedbackformat' => '1',
02210                         'defaultgrade' => '2.0000000',
02211                         'penalty' => '0.0000000',
02212                         'qtype' => 'numerical',
02213                         'length' => '1',
02214                         'stamp' => 'tjh238.vledev2.open.ac.uk+110525164440+Xr29c2',
02215                         'version' => 'tjh238.vledev2.open.ac.uk+110525164441+QTwsGM',
02216                         'hidden' => '0',
02217                         'timecreated' => '1306341880',
02218                         'timemodified' => '1306341880',
02219                         'createdby' => '2',
02220                         'modifiedby' => '2',
02221                         'options' => (object) array(
02222                             'answers' => array(
02223                                 36 => (object) array(
02224                                     'id' => '36',
02225                                     'question' => '22',
02226                                     'answer' => '23.8',
02227                                     'answerformat' => '0',
02228                                     'fraction' => '1.0000000',
02229                                     'feedback' => 'Feedback for correct answer  23.8',
02230                                     'feedbackformat' => '1',
02231                                     'tolerance' => '0.1',
02232                                 ),
02233                                 37 => (object) array(
02234                                     'id' => '37',
02235                                     'question' => '22',
02236                                     'answer' => '23.8',
02237                                     'answerformat' => '0',
02238                                     'fraction' => '0.5000000',
02239                                     'feedback' => 'Feedback for half credit answer in the nearby region of  the correct answer',
02240                                     'feedbackformat' => '1',
02241                                     'tolerance' => '2',
02242                                 ),
02243                             ),
02244                             'units' => array(
02245                             ),
02246                             'unitgradingtype' => '0',
02247                             'unitpenalty' => '1.0000000',
02248                             'showunits' => '3',
02249                             'unitsleft' => '0',
02250                             'instructions' => '',
02251                             'instructionsformat' => '1',
02252                         ),
02253                         'maxgrade' => '2.0000000',
02254                     ),
02255                     4 => (object) array(
02256                         'id' => '23',
02257                         'category' => '2',
02258                         'parent' => '19',
02259                         'name' => 'Cloze',
02260                         'questiontext' => '{2:MCV:1. Wrong answer#Feedback for this wrong answer~2. Another wrong  answer#Feedback for the other wrong answer~=3. Correct answer#Feedback  for correct answer~%50%4. Answer that gives half the credit#Feedback for  half credit answer}',
02261                         'questiontextformat' => '0',
02262                         'generalfeedback' => '',
02263                         'generalfeedbackformat' => '1',
02264                         'defaultgrade' => '2.0000000',
02265                         'penalty' => '0.0000000',
02266                         'qtype' => 'multichoice',
02267                         'length' => '1',
02268                         'stamp' => 'tjh238.vledev2.open.ac.uk+110525164441+7R55HA',
02269                         'version' => 'tjh238.vledev2.open.ac.uk+110525164441+uCMoQc',
02270                         'hidden' => '0',
02271                         'timecreated' => '1306341881',
02272                         'timemodified' => '1306341881',
02273                         'createdby' => '2',
02274                         'modifiedby' => '2',
02275                         'options' => (object) array(
02276                             'id' => '4',
02277                             'question' => '23',
02278                             'layout' => '1',
02279                             'answers' => array(
02280                                 38 => (object) array(
02281                                     'id' => '38',
02282                                     'question' => '23',
02283                                     'answer' => '1. Wrong answer',
02284                                     'answerformat' => '1',
02285                                     'fraction' => '0.0000000',
02286                                     'feedback' => 'Feedback for this wrong answer',
02287                                     'feedbackformat' => '1',
02288                                 ),
02289                                 39 => (object) array(
02290                                     'id' => '39',
02291                                     'question' => '23',
02292                                     'answer' => '2. Another wrong  answer',
02293                                     'answerformat' => '1',
02294                                     'fraction' => '0.0000000',
02295                                     'feedback' => 'Feedback for the other wrong answer',
02296                                     'feedbackformat' => '1',
02297                                 ),
02298                                 40 => (object) array(
02299                                     'id' => '40',
02300                                     'question' => '23',
02301                                     'answer' => '3. Correct answer',
02302                                     'answerformat' => '1',
02303                                     'fraction' => '1.0000000',
02304                                     'feedback' => 'Feedback  for correct answer',
02305                                     'feedbackformat' => '1',
02306                                 ),
02307                                 41 => (object) array(
02308                                     'id' => '41',
02309                                     'question' => '23',
02310                                     'answer' => '4. Answer that gives half the credit',
02311                                     'answerformat' => '1',
02312                                     'fraction' => '0.5000000',
02313                                     'feedback' => 'Feedback for  half credit answer',
02314                                     'feedbackformat' => '1',
02315                                 ),
02316                             ),
02317                             'single' => '1',
02318                             'shuffleanswers' => '1',
02319                             'correctfeedback' => '',
02320                             'correctfeedbackformat' => '1',
02321                             'partiallycorrectfeedback' => '',
02322                             'partiallycorrectfeedbackformat' => '1',
02323                             'incorrectfeedback' => '',
02324                             'incorrectfeedbackformat' => '1',
02325                             'answernumbering' => '0',
02326                         ),
02327                         'maxgrade' => '2.0000000',
02328                     ),
02329                     5 => (object) array(
02330                         'id' => '24',
02331                         'category' => '2',
02332                         'parent' => '19',
02333                         'name' => 'Cloze',
02334                         'questiontext' => '{2:MCH:a. Wrong answer#Feedback for this wrong answer~b. Another wrong  answer#Feedback for the other wrong answer~=c. Correct answer#Feedback  for correct answer~%50%d. Answer that gives half the credit#Feedback for  half credit answer}',
02335                         'questiontextformat' => '0',
02336                         'generalfeedback' => '',
02337                         'generalfeedbackformat' => '1',
02338                         'defaultgrade' => '2.0000000',
02339                         'penalty' => '0.0000000',
02340                         'qtype' => 'multichoice',
02341                         'length' => '1',
02342                         'stamp' => 'tjh238.vledev2.open.ac.uk+110525164441+QGvRpd',
02343                         'version' => 'tjh238.vledev2.open.ac.uk+110525164441+03GsSs',
02344                         'hidden' => '0',
02345                         'timecreated' => '1306341881',
02346                         'timemodified' => '1306341881',
02347                         'createdby' => '2',
02348                         'modifiedby' => '2',
02349                         'options' => (object) array(
02350                             'id' => '5',
02351                             'question' => '24',
02352                             'layout' => '2',
02353                             'answers' => array(
02354                                 42 => (object) array(
02355                                     'id' => '42',
02356                                     'question' => '24',
02357                                     'answer' => 'a. Wrong answer',
02358                                     'answerformat' => '1',
02359                                     'fraction' => '0.0000000',
02360                                     'feedback' => 'Feedback for this wrong answer',
02361                                     'feedbackformat' => '1',
02362                                 ),
02363                                 43 => (object) array(
02364                                     'id' => '43',
02365                                     'question' => '24',
02366                                     'answer' => 'b. Another wrong  answer',
02367                                     'answerformat' => '1',
02368                                     'fraction' => '0.0000000',
02369                                     'feedback' => 'Feedback for the other wrong answer',
02370                                     'feedbackformat' => '1',
02371                                 ),
02372                                 44 => (object) array(
02373                                     'id' => '44',
02374                                     'question' => '24',
02375                                     'answer' => 'c. Correct answer',
02376                                     'answerformat' => '1',
02377                                     'fraction' => '1.0000000',
02378                                     'feedback' => 'Feedback  for correct answer',
02379                                     'feedbackformat' => '1',
02380                                 ),
02381                                 45 => (object) array(
02382                                     'id' => '45',
02383                                     'question' => '24',
02384                                     'answer' => 'd. Answer that gives half the credit',
02385                                     'answerformat' => '1',
02386                                     'fraction' => '0.5000000',
02387                                     'feedback' => 'Feedback for  half credit answer',
02388                                     'feedbackformat' => '1',
02389                                 ),
02390                             ),
02391                             'single' => '1',
02392                             'shuffleanswers' => '1',
02393                             'correctfeedback' => '',
02394                             'correctfeedbackformat' => '1',
02395                             'partiallycorrectfeedback' => '',
02396                             'partiallycorrectfeedbackformat' => '1',
02397                             'incorrectfeedback' => '',
02398                             'incorrectfeedbackformat' => '1',
02399                             'answernumbering' => '0',
02400                         ),
02401                         'maxgrade' => '2.0000000',
02402                     ),
02403                     6 => (object) array(
02404                         'id' => '25',
02405                         'category' => '2',
02406                         'parent' => '19',
02407                         'name' => 'Cloze',
02408                         'questiontext' => '{1:SHORTANSWER_C:moodle#Feedback for moodle in lower  case ~=MOODLE#Feedback for MOODLE in upper case ~%50%Moodle#Feedback for  only first letter in upper case}',
02409                         'questiontextformat' => '0',
02410                         'generalfeedback' => '',
02411                         'generalfeedbackformat' => '1',
02412                         'defaultgrade' => '1.0000000',
02413                         'penalty' => '0.0000000',
02414                         'qtype' => 'shortanswer',
02415                         'length' => '1',
02416                         'stamp' => 'tjh238.vledev2.open.ac.uk+110525164441+n9ETJC',
02417                         'version' => 'tjh238.vledev2.open.ac.uk+110525164441+Bvqo6c',
02418                         'hidden' => '0',
02419                         'timecreated' => '1306341881',
02420                         'timemodified' => '1306341881',
02421                         'createdby' => '2',
02422                         'modifiedby' => '2',
02423                         'options' => (object) array(
02424                             'answers' => array(
02425                                 46 => (object) array(
02426                                     'id' => '46',
02427                                     'question' => '25',
02428                                     'answer' => 'moodle',
02429                                     'answerformat' => '0',
02430                                     'fraction' => '0.0000000',
02431                                     'feedback' => 'Feedback for moodle in lower  case',
02432                                     'feedbackformat' => '1',
02433                                 ),
02434                                 47 => (object) array(
02435                                     'id' => '47',
02436                                     'question' => '25',
02437                                     'answer' => 'MOODLE',
02438                                     'answerformat' => '0',
02439                                     'fraction' => '1.0000000',
02440                                     'feedback' => 'Feedback for MOODLE in upper case',
02441                                     'feedbackformat' => '1',
02442                                 ),
02443                                 48 => (object) array(
02444                                     'id' => '48',
02445                                     'question' => '25',
02446                                     'answer' => 'Moodle',
02447                                     'answerformat' => '0',
02448                                     'fraction' => '0.5000000',
02449                                     'feedback' => 'Feedback for  only first letter in upper case',
02450                                     'feedbackformat' => '1',
02451                                 ),
02452                             ),
02453                             'usecase' => '1',
02454                         ),
02455                         'maxgrade' => '1.0000000',
02456                     ),
02457                     7 => (object) array(
02458                         'id' => '26',
02459                         'category' => '2',
02460                         'parent' => '19',
02461                         'name' => 'Cloze',
02462                         'questiontext' => '{:MULTICHOICE:=Yes#Correct~No#We have a different opinion}',
02463                         'questiontextformat' => '0',
02464                         'generalfeedback' => '',
02465                         'generalfeedbackformat' => '1',
02466                         'defaultgrade' => '1.0000000',
02467                         'penalty' => '0.0000000',
02468                         'qtype' => 'multichoice',
02469                         'length' => '1',
02470                         'stamp' => 'tjh238.vledev2.open.ac.uk+110525164441+0YjnZ7',
02471                         'version' => 'tjh238.vledev2.open.ac.uk+110525164441+1giLRX',
02472                         'hidden' => '0',
02473                         'timecreated' => '1306341881',
02474                         'timemodified' => '1306341881',
02475                         'createdby' => '2',
02476                         'modifiedby' => '2',
02477                         'options' => (object) array(
02478                             'id' => '6',
02479                             'question' => '26',
02480                             'layout' => '0',
02481                             'answers' => array(
02482                                 49 => (object) array(
02483                                     'id' => '49',
02484                                     'question' => '26',
02485                                     'answer' => 'Yes',
02486                                     'answerformat' => '1',
02487                                     'fraction' => '1.0000000',
02488                                     'feedback' => 'Correct',
02489                                     'feedbackformat' => '1',
02490                                 ),
02491                                 50 => (object) array(
02492                                     'id' => '50',
02493                                     'question' => '26',
02494                                     'answer' => 'No',
02495                                     'answerformat' => '1',
02496                                     'fraction' => '0.0000000',
02497                                     'feedback' => 'We have a different opinion',
02498                                     'feedbackformat' => '1',
02499                                 ),
02500                             ),
02501                             'single' => '1',
02502                             'shuffleanswers' => '1',
02503                             'correctfeedback' => '',
02504                             'correctfeedbackformat' => '1',
02505                             'partiallycorrectfeedback' => '',
02506                             'partiallycorrectfeedbackformat' => '1',
02507                             'incorrectfeedback' => '',
02508                             'incorrectfeedbackformat' => '1',
02509                             'answernumbering' => '0',
02510                         ),
02511                         'maxgrade' => '1.0000000',
02512                     ),
02513                     8 => (object) array(
02514                         'id' => '27',
02515                         'category' => '2',
02516                         'parent' => '19',
02517                         'name' => 'Cloze',
02518                         'questiontext' => '{3:NUMERICAL:=3:2}',
02519                         'questiontextformat' => '0',
02520                         'generalfeedback' => '',
02521                         'generalfeedbackformat' => '1',
02522                         'defaultgrade' => '3.0000000',
02523                         'penalty' => '0.0000000',
02524                         'qtype' => 'numerical',
02525                         'length' => '1',
02526                         'stamp' => 'tjh238.vledev2.open.ac.uk+110525164441+glbCBN',
02527                         'version' => 'tjh238.vledev2.open.ac.uk+110525164441+xWusxR',
02528                         'hidden' => '0',
02529                         'timecreated' => '1306341881',
02530                         'timemodified' => '1306341881',
02531                         'createdby' => '2',
02532                         'modifiedby' => '2',
02533                         'options' => (object) array(
02534                             'answers' => array(
02535                                 51 => (object) array(
02536                                     'id' => '51',
02537                                     'question' => '27',
02538                                     'answer' => '3',
02539                                     'answerformat' => '0',
02540                                     'fraction' => '1.0000000',
02541                                     'feedback' => '',
02542                                     'feedbackformat' => '1',
02543                                     'tolerance' => '2',
02544                                 ),
02545                             ),
02546                             'units' => array(
02547                             ),
02548                             'unitgradingtype' => '0',
02549                             'unitpenalty' => '1.0000000',
02550                             'showunits' => '3',
02551                             'unitsleft' => '0',
02552                             'instructions' => '',
02553                             'instructionsformat' => '1',
02554                         ),
02555                         'maxgrade' => '3.0000000',
02556                     ),
02557                 ),
02558             ),
02559             'defaultmark' => '13.0000000',
02560         );
02561         $qsession = (object) array(
02562             'id' => '109',
02563             'attemptid' => '18',
02564             'questionid' => '19',
02565             'newest' => '299',
02566             'newgraded' => '299',
02567             'sumpenalty' => '5.2000000',
02568             'manualcomment' => '',
02569             'manualcommentformat' => '1',
02570             'flagged' => '0',
02571         );
02572         $qstates = array(
02573             292 => (object) array(
02574                 'id' => '292',
02575                 'attempt' => '18',
02576                 'question' => '19',
02577                 'seq_number' => '0',
02578                 'answer' => '1-,2-,3-,4-,5-,6-,7-,8-',
02579                 'timestamp' => '1306425784',
02580                 'event' => '0',
02581                 'grade' => '0.0000000',
02582                 'raw_grade' => '0.0000000',
02583                 'penalty' => '0.0000000',
02584             ),
02585             294 => (object) array(
02586                 'id' => '294',
02587                 'attempt' => '18',
02588                 'question' => '19',
02589                 'seq_number' => '1',
02590                 'answer' => '1-32,2-asdgf,3-saedf,4-39,5-43,6-sadf,7-,8-',
02591                 'timestamp' => '1306425801',
02592                 'event' => '3',
02593                 'grade' => '0.5000000',
02594                 'raw_grade' => '0.5000000',
02595                 'penalty' => '1.3000000',
02596             ),
02597             295 => (object) array(
02598                 'id' => '295',
02599                 'attempt' => '18',
02600                 'question' => '19',
02601                 'seq_number' => '2',
02602                 'answer' => '1-31,2-asdgf,3-28.3,4-40,5-44,6-MOODLE,7-49,8-13',
02603                 'timestamp' => '1306425836',
02604                 'event' => '3',
02605                 'grade' => '5.7000000',
02606                 'raw_grade' => '7.0000000',
02607                 'penalty' => '1.3000000',
02608             ),
02609             296 => (object) array(
02610                 'id' => '296',
02611                 'attempt' => '18',
02612                 'question' => '19',
02613                 'seq_number' => '3',
02614                 'answer' => '1-31,2-Correct answer,3-23.8,4-40,5-44,6-MOODLE,7-49,8-3',
02615                 'timestamp' => '1306425886',
02616                 'event' => '3',
02617                 'grade' => '9.4000000',
02618                 'raw_grade' => '12.0000000',
02619                 'penalty' => '1.3000000',
02620             ),
02621             299 => (object) array(
02622                 'id' => '299',
02623                 'attempt' => '18',
02624                 'question' => '19',
02625                 'seq_number' => '4',
02626                 'answer' => '1-31,2-Correct answer,3-23.8,4-40,5-44,6-MOODLE,7-49,8-3',
02627                 'timestamp' => '1306425886',
02628                 'event' => '6',
02629                 'grade' => '9.4000000',
02630                 'raw_grade' => '12.0000000',
02631                 'penalty' => '1.3000000',
02632             ),
02633         );
02634 
02635         $qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates);
02636 
02637         $expectedqa = (object) array(
02638             'behaviour' => 'adaptivenopenalty',
02639             'questionid' => 19,
02640             'variant' => 1,
02641             'maxmark' => 13.0000000,
02642             'minfraction' => 0,
02643             'flagged' => 0,
02644             'questionsummary' => 'This question consists of some text with an answer embedded right here {Wrong answer; Another wrong answer; Correct answer; Answer that gives half the credit}
02645 
02646 and right after that you will have to deal with this short answer _____
02647 
02648 and finally we have a floating point number _____.
02649 
02650 The multichoice question can also be shown in the vertical display of the standard moodle multiple choice. {1. Wrong answer; 2. Another wrong answer; 3. Correct answer; 4. Answer that gives half the credit}
02651 
02652 Or in an horizontal display that is included here in a table {a. Wrong answer; b. Another wrong answer; c. Correct answer; d. Answer that gives half the credit}
02653 
02654 A shortanswer question where case must match. Write moodle in upper case letters _____
02655 
02656 Note that addresses like www.moodle.org and smileys :-) all work as normal:
02657 
02658 a) How good is this? {Yes; No}
02659 
02660 b) What grade would you give it? _____',
02661             'rightanswer' => 'part 1: Correct answer; part 2: Correct answer; part 3: 23.8; part 4: 3. Correct answer; part 5: c. Correct answer; part 6: MOODLE; part 7: Yes; part 8: 3',
02662             'responsesummary' => 'part 1: Correct answer; part 2: Correct answer; part 3: 23.8; part 4: 3. Correct answer; part 5: c. Correct answer; part 6: MOODLE; part 7: Yes; part 8: 3',
02663             'timemodified' => 1306425886,
02664             'steps' => array(
02665                 0 => (object) array(
02666                     'sequencenumber' => 0,
02667                     'state' => 'todo',
02668                     'fraction' => null,
02669                     'timecreated' => 1306425784,
02670                     'userid' => 3,
02671                     'data' => array('_sub1_order' => '29,30,31,32',
02672                             '_sub3_separators' => '.$,', '_sub4_order' => '38,39,40,41',
02673                             '_sub5_order' => '42,43,44,45', '_sub7_order' => '49,50',
02674                             '_sub8_separators' => '.$,'),
02675                 ),
02676                 1 => (object) array(
02677                     'sequencenumber' => 1,
02678                     'state' => 'todo',
02679                     'fraction' => 0.038461538461538464,
02680                     'timecreated' => 1306425801,
02681                     'userid' => 3,
02682                     'data' => array('sub1_answer' => '3', 'sub2_answer' => 'asdgf',
02683                             'sub3_answer' => 'saedf', 'sub4_answer' => '1',
02684                             'sub5_answer' => '1', 'sub6_answer' => 'sadf',
02685                             '-_try' => '1',
02686                             '-_rawfraction' => '0.038461538461538464', '-submit' => '1'),
02687                 ),
02688                 2 => (object) array(
02689                     'sequencenumber' => 2,
02690                     'state' => 'todo',
02691                     'fraction' => 0.43846153846153845,
02692                     'timecreated' => 1306425836,
02693                     'userid' => 3,
02694                     'data' => array('sub1_answer' => '2', 'sub2_answer' => 'asdgf',
02695                             'sub3_answer' => '28.3', 'sub4_answer' => '2',
02696                             'sub5_answer' => '2', 'sub6_answer' => 'MOODLE',
02697                             'sub7_answer' => '0', 'sub8_answer' => '13', '-_try' => '2',
02698                             '-_rawfraction' => '0.53846153846153845', '-submit' => '1'),
02699                 ),
02700                 3 => (object) array(
02701                     'sequencenumber' => 3,
02702                     'state' => 'todo',
02703                     'fraction' => 0.72307692307692311,
02704                     'timecreated' => 1306425886,
02705                     'userid' => 3,
02706                     'data' => array('sub1_answer' => '2', 'sub2_answer' => 'Correct answer',
02707                             'sub3_answer' => '23.8', 'sub4_answer' => '2',
02708                             'sub5_answer' => '2', 'sub6_answer' => 'MOODLE',
02709                             'sub7_answer' => '0', 'sub8_answer' => '3', '-_try' => '3',
02710                             '-_rawfraction' => '0.92307692307692311', '-submit' => '1'),
02711                 ),
02712                 4 => (object) array(
02713                     'sequencenumber' => 4,
02714                     'state' => 'gradedpartial',
02715                     'fraction' => 0.72307692307692311,
02716                     'timecreated' => 1306425886,
02717                     'userid' => 3,
02718                     'data' => array('sub1_answer' => '2', 'sub2_answer' => 'Correct answer',
02719                             'sub3_answer' => '23.8', 'sub4_answer' => '2',
02720                             'sub5_answer' => '2', 'sub6_answer' => 'MOODLE',
02721                             'sub7_answer' => '0', 'sub8_answer' => '3', '-_try' => '3',
02722                             '-_rawfraction' => '0.92307692307692311', '-finish' => '1'),
02723                 ),
02724             ),
02725         );
02726 
02727         $this->compare_qas($expectedqa, $qa);
02728     }
02729 }
 All Data Structures Namespaces Files Functions Variables Enumerations